Skip to content
New issue

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

ResolveFully ignores properties in schema with combinators #1802

Open
devdevx opened this issue Sep 20, 2022 · 0 comments
Open

ResolveFully ignores properties in schema with combinators #1802

devdevx opened this issue Sep 20, 2022 · 0 comments
Assignees

Comments

@devdevx
Copy link
Contributor

devdevx commented Sep 20, 2022

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)

devdevx added a commit to devdevx/swagger-parser that referenced this issue Oct 10, 2022
gracekarina added a commit that referenced this issue Dec 19, 2022
Extend resolve fully and solve issues #1777 and #1802
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants