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

WIP: API doc via SwaggerUI #54

Closed
wants to merge 13 commits into from
Closed

Conversation

georg-schwarz
Copy link
Member

No description provided.

@georg-schwarz georg-schwarz reopened this Apr 21, 2020
@georg-schwarz georg-schwarz linked an issue Apr 21, 2020 that may be closed by this pull request
@georg-schwarz
Copy link
Member Author

Still have to remove old documentation from README files..
But feedback is already very welcome :)


@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
Copy link
Contributor

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?

Copy link
Member Author

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?

Copy link
Contributor

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()
Copy link
Contributor

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?

Copy link
Member Author

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) {
Copy link
Contributor

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

Copy link
Member Author

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)

Copy link
Member Author

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?

Copy link
Contributor

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) {
Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

@georg-schwarz
Copy link
Member Author

Will go over it when the event-driven version is merged

georg-schwarz added a commit that referenced this pull request Feb 12, 2021
Resolve "Refactor PipelineConfig"

Closes #46 and #54

See merge request profoss/open-data-service/ods-main!38
georg-schwarz pushed a commit that referenced this pull request Feb 12, 2021
Resolve "Refactor PipelineConfig"

Closes #46 and #54

See merge request profoss/open-data-service/ods-main!38
@georg-schwarz georg-schwarz deleted the 42-api-doc-swagger-ui branch February 12, 2021 09:45
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

Successfully merging this pull request may close these issues.

API documentation with Swagger UI
2 participants