swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

ResolveFully not resolving extensions of child schemas

Open namit26 opened this issue 5 years ago • 2 comments
trafficstars

At line 462 of ResolveFully class, extensions of only source schemas are being added to target schema. Shouldn’t it copy extensions of resolved schemas as well, similar to the way properties and required of resolved schemas are handled? https://github.com/swagger-api/swagger-parser/blob/2db8c628cbbfdd8afb972965698e011c93747b15/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/ResolverFully.java#L462

namit26 avatar Dec 07 '19 08:12 namit26

can you add sample files or possibly a pr with failing test case?.

r-sreesaran avatar Jan 16 '20 11:01 r-sreesaran

Here's a simple case to reproduce

openapi: "3.0.2"
info:
  title: "Extension not inherited"
  
components:
  schemas:    
    ResponseModel:
      x-extension-ref: 1
      type: object
      required:
        - data
      properties:
        data:
          type: "string" 
          
paths:
  /test/extensions/not/inherited:
    get:
      responses:
        200:
          content:
            application/json:
              schema:
                allOf:
                - $ref: "#/components/schemas/ResponseModel"
                - type: "object"
                  required:
                  - "data"
                  properties: 
                    data2:
                      type: "string"

EricAntoni avatar Mar 02 '21 16:03 EricAntoni

fixed in #1681 and #1837

frantuma avatar Oct 17 '22 21:10 frantuma