Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow up to #2940397: Provide x-definition to superseded x-entity-type
This added x-definition to tags
but because it uses $ref
this causes a problem if the entity type is not included in the definitions
section.
\Drupal\openapi\OpenApiGenerator\OpenApiRestGenerator::getTags
probably always should have been checking for $options['entity_type_id']
but since x-entity-type
wasn't a OpenApi $ref
it didn't cause a problem if the entity type was in the definitions
section. Now it crashes swagger_ui because it references non-existing node.
Comment | File | Size | Author |
---|---|---|---|
#3 | 2948198-3-TEST_ONLY.patch | 2.64 KB | tedbow |
| |||
#3 | 2948198-3b.patch | 4.61 KB | tedbow |
| |||
#2 | 2948198-2.patch | 786 bytes | tedbow |
|
Comments
Comment #2
tedbowHere is a fix
Comment #3
tedbowI forgot that we have
::includeEntityTypeBundle()
which takes care of this.Also adding tests to assert that all the tags in method section equals the tags section. To test this it now enables all REST resources for each request and ignores
$options
. This makes sure that if other resources are enabled but they are not in current request options they will not affect the returned spec.Comment #5
tedbowForgot to upload 2948198-3-TEST_ONLY.patch first. Expected fail.
Comment #6
richgerdesMy bad on not testing the docs modules. We need to make sure they have good test coverage to prevent this from happening. We may was to see if there is a php cli or rest tool that can be used to validate the schema as part of ci tests. That would also eliviate the need to validate the api schema by testing it against a cloud tool. we would then just have to verify that the correct information is generated for drupal to handle.
Marking this as RTBC. Its good to merge unless you come across other issues.
Comment #8
tedbowNo, problem there should have been basic test long before you got involved in with this project, my bad.
Comment #9
tedbowCreated #2948564: Create tests for OpenApi Swagger UI module as a follow up