Skip to content

ResolveFully ignores properties in schema with combinators #1802

@devdevx

Description

@devdevx

Parser version:

2.1.2

Spec:

openapi: "3.0.0"
info:
  version: 1.0.0
  title: 0001_allOffProps

paths:
  /sample_resource:
    post:
      operationId: createResOne
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/create_res_one"
      responses:
        '201':
          description: Ok
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/standard_response_res_one"
components:
  schemas:
    standard_response_result:
      properties:
        result:
          type: object
          properties:
            status:
              type: boolean
            http_code:
              type: integer
            errors:
              type: array
              items:
                $ref: '#/components/schemas/standard_error'
            info:
              type: string
            trace_id:
              type: string
            num_elements:
              type: integer
          required:
            - status
            - http_code
            - trace_id
    standard_error:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
    standard_response_res_one:
      type: object
      allOf:
        - $ref: '#/components/schemas/standard_response_result'
      properties:
        data:
          properties:
            name:
              type: string
    create_res_one:
      type: object
      properties:
        name:
          type: string

Code:

        ParseOptions parseOptions = new ParseOptions();
        parseOptions.setResolveFully(true);
        OpenAPI openAPI = new OpenAPIV3Parser().read("api.yaml" + fileName, null, parseOptions);

Expected result:

The schema standard_response_res_one has 2 properties: data and result

Current result:

The schema standard_response_res_one only has the result property

Investigation about the issue cause:

After debugging the issue seems that in the class ResolverFully we need to add the properties of the composedSchema to the result schema (https://github.com/swagger-api/swagger-parser/blob/master/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/ResolverFully.java#L405)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions