restful-react icon indicating copy to clipboard operation
restful-react copied to clipboard

`schemas.[name].properties` are ignored when `allOf` is present

Open wei opened this issue 3 years ago • 1 comments

Describe the bug properties are ignored when allOf and properties are both present at the same level.

To Reproduce Steps to reproduce the behavior:

  1. Example schema: https://gist.github.com/wei/af7976a2bbdf4e0c4ed1013559d58578/revisions#diff-bea257c04d5327bd1cb2994a43299a45f926bf90e20e091a5e38d6faae3619dd
    Pet:
      description: A pet.
      allOf:
        - $ref: "#/components/schemas/NewPet"
      properties:
        id:
          type: integer
          format: int64
    
  2. We get
    export type Pet = NewPet;
    

Expected behavior

export type Pet = NewPet & {
  id: number;
};

Additional context https://github.com/contiamo/restful-react/blob/7f1f69b358a248a9a55fe58f5717622bc1d304ad/src/scripts/import-open-api.ts#L122-L129 ^ As seen here, schemas.[name].properties are ignored when schemas.[name].allOf is present.

wei avatar Apr 05 '21 16:04 wei

Indeed, good catch! Thanks for the reporting

fabien0102 avatar Apr 06 '21 08:04 fabien0102