We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We are trying to enforce some properties via required together with allOf to reuse existing definitions:
required
allOf
openapi: 3.0.0 info: title: Minimal OpenAPI 3.0 with required on the same allOf version: 1.0.0 paths: /pets: post: requestBody: content: application/json: schema: $ref: '#/components/schemas/PetCreate' responses: '201': description: Created components: schemas: Pet: type: object properties: id: type: integer name: type: string PetCreate: allOf: - $ref: '#/components/schemas/Pet' required: - name
But using setResolveFully(true), the required attribute will get lost:
setResolveFully(true)
@Test public void requiredAllResolveFully() { ParseOptions options = new ParseOptions(); options.setResolveFully(true); OpenAPI openAPI = new OpenAPIV3Parser().read("required-anyOf.yaml", null, options); RequestBody requestBody = openAPI.getPaths().get("/pets").getPost().getRequestBody(); Schema requestBodySchema = requestBody.getContent().get("application/json").getSchema(); assertNull(requestBodySchema.get$ref()); // has been inlined Schema schema = requestBody.getContent().get("application/json").getSchema(); assertEquals(schema.getProperties().size(),2); assertEquals(schema.getRequired().size(),1); // <-- FAILS, as its empty }
The text was updated successfully, but these errors were encountered:
Another variation of this bug with nested allOf/anyOf:
anyOf
openapi: 3.0.0 info: title: Minimal OpenAPI 3.0 with allOf version: 1.0.0 paths: /pets: post: requestBody: content: application/json: schema: $ref: '#/components/schemas/PetCreate' responses: '201': description: Created components: schemas: Pet: type: object properties: id: type: integer Cow: type: object PetCreate: allOf: - anyOf: - $ref: '#/components/schemas/Pet' - $ref: '#/components/schemas/Cow' - properties: name: type: string
@Test public void allOfAnyOfResolveFully() { ParseOptions options = new ParseOptions(); options.setResolveFully(true); OpenAPI openAPI = new OpenAPIV3Parser().read("required-anyOf.yaml", null, options); RequestBody requestBody = openAPI.getPaths().get("/pets").getPost().getRequestBody(); Schema requestBodySchema = requestBody.getContent().get("application/json").getSchema(); assertNull(requestBodySchema.get$ref()); // has been inlined Schema schema = requestBody.getContent().get("application/json").getSchema(); assertEquals(schema.getProperties().size(),2); // <!--FAILS, since id got lost }
Sorry, something went wrong.
fix #2081 - support nested composed schemas in resolveFully
772be8c
0ab2e8a
Any idea when this fixed will be released? We're also stumbling into this problem..
frantuma
No branches or pull requests
We are trying to enforce some properties via
required
together withallOf
to reuse existing definitions:But using
setResolveFully(true)
, therequired
attribute will get lost:The text was updated successfully, but these errors were encountered: