jnwltr / swagger-angular-generator

Generator of API layer in TypeScript for Angular 2+ apps
MIT License
91 stars 46 forks source link

Ignore options methods in a swagger def #127

Closed WTIGER001 closed 4 years ago

WTIGER001 commented 4 years ago

I have added a filter in front of the map function that generates each method. This filter removes the methods that are not configured. My only current example is a 'options' method that is needed for CORS support.

jnwltr commented 4 years ago

OpenAPI 2 specs name even head and options methods as legitimate. If you think, they are not intended for direct invocation in your case, you should take care of their exclusion when the schema is generated.

WTIGER001 commented 4 years ago

I am confused then. Why does the MethodNames type then not include them ? When I try to use an options method I get an error where it goes to generate the method. The allowed field is undefined. Line 25 of 'process-methods.ts'

const allowed: string[] = conf.allowedParams[method.methodName];

returns an undefined value because 'options' is not an allowedParams property.