-
Notifications
You must be signed in to change notification settings - Fork 23
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
WIP: API doc via SwaggerUI #54
Conversation
…to initialize app
Still have to remove old documentation from README files.. |
|
||
@Bean | ||
public Docket api() { | ||
return new Docket(DocumentationType.SWAGGER_2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no support for OpenAPI3 yet, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think there is but it requires another library / mechanism. Probably makes sense to do so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it make sense to use the newest version of the specification if it is included in a spring boot plugin. If we need some kind of workaround or a lot of effort I would rather wait until the spring boot compatible version is updated to the new spec.
const port = 8080 | ||
|
||
const app: Application = express() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need that for swagger or did you just fix it on the fly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it because I wanted to declare the endpoint in a different file :D
// initialize swagger-jsdoc | ||
const swaggerSpec = swaggerGen(options); | ||
|
||
export function enableSwagger(app: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to export the swaggerSpec and define the endpoint in index.ts?
I think I would prefer having all the endpoints in one place, even the meta ones describing the API itself :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather pull all files with API into an api
directory or by domain. Declaring everything in the index.ts
is something that I consider as ok, but not on the long run. Especially as services grow (one file for config endpoints, one file for stateless functionality endpoints for example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So would renaming it to swaggerApi.ts
be ok for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, I also think having an api directory would be the cleanest solution. So, yes, renaming would be fine!
// initialize swagger-jsdoc | ||
const swaggerSpec = swaggerGen(options); | ||
|
||
export function enableSwagger(app: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above in transformation/swagger.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
Will go over it when the event-driven version is merged |
No description provided.