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

Issue with routing-controllers-openapi #6

Closed
andrew-ignatiev opened this issue Sep 13, 2018 · 1 comment
Closed

Issue with routing-controllers-openapi #6

andrew-ignatiev opened this issue Sep 13, 2018 · 1 comment

Comments

@andrew-ignatiev
Copy link

andrew-ignatiev commented Sep 13, 2018

Hey Aleksi,

Thank you for your quick update. But seems the recent update of dependency now cause issue with type of generated schemas which is not assignable to additionalProperties: Partial<OpenAPIObject> in routing-controllers-openapi .

const metadatas = (getFromContainer(MetadataStorage) as any).validationMetadatas;
const schemas = validationMetadatasToSchemas(metadatas, {
  refPointerPrefix: '#/components/schemas/',
});

// Parse routing-controllers classes into OpenAPI spec:
const storage = getMetadataArgsStorage();
const spec = routingControllersToSpec(storage, routingControllersOptions, {
  components: { schemas }
});

The code above now generates outputs with error:

error TS2345: Argument of type '{ components: { schemas: { [key: string]: SchemaObject; }; }; }' is not assignable to parameter of type 'Partial'.
Types of property 'components' are incompatible.
Type '{ schemas: { [key: string]: SchemaObject; }; }' is not assignable to type 'ComponentsObject'.
Types of property 'schemas' are incompatible.
Type '{ [key: string]: SchemaObject; }' is not assignable to type '{ [schema: string]:SchemaObject; }'.

Could you check please?

@epiphone
Copy link
Owner

Right, I forgot to bump up openapi3-ts in routing-controllers-openapi too. Pushed a fix now. Good catch!

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