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

enumName cannot be used with oneOf #1125

Open
murbanowicz opened this issue Jan 11, 2021 · 3 comments
Open

enumName cannot be used with oneOf #1125

murbanowicz opened this issue Jan 11, 2021 · 3 comments

Comments

@murbanowicz
Copy link

It is impossible to use enumName when using oneOf which makes not possible to share enums definitions in this case.
Is there any chance for that to be fixed or it has some implications which are not easy to overcome?

@kamilmysliwiec
Copy link
Member

Please provide a minimum reproduction repository.

@murbanowicz
Copy link
Author

It comes straight from the types, so I believe repro is not required.

https://github.com/nestjs/swagger/blob/master/lib/interfaces/schema-object-metadata.interface.ts

export interface SchemaObjectMetadata
  extends Omit<SchemaObject, 'type' | 'required'> {
  type?: Type<unknown> | Function | [Function] | string | Record<string, any>;
  isArray?: boolean;
  required?: boolean;
  name?: string;
  enumName?: string;
}

So enumName can be used when only one type is available.

oneOf?: (SchemaObject | ReferenceObject)[];

enumName is not present in either SchemaObject or ReferenceObject

@kamilmysliwiec
Copy link
Member

Would you like to create a PR for this issue?

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