Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

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

Open
wei opened this issue Apr 5, 2021 · 1 comment
Open

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

wei opened this issue Apr 5, 2021 · 1 comment

Comments

@wei
Copy link

wei commented Apr 5, 2021

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

export const getObject = (item: SchemaObject): string => {
if (isReference(item)) {
return getRef(item.$ref);
}
if (item.allOf) {
return item.allOf.map(resolveValue).join(" & ");
}

^ As seen here, schemas.[name].properties are ignored when schemas.[name].allOf is present.

@fabien0102
Copy link
Contributor

Indeed, good catch! Thanks for the reporting

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants