-
Notifications
You must be signed in to change notification settings - Fork 8
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
refactor(model-server): prevent duplicate problem types #877
Merged
languitar
merged 5 commits into
main
from
feature/MODELIX-948-Prevent-duplication-of-the-Problem-type-in-spec-and-code
Jul 30, 2024
Merged
refactor(model-server): prevent duplicate problem types #877
languitar
merged 5 commits into
main
from
feature/MODELIX-948-Prevent-duplication-of-the-Problem-type-in-spec-and-code
Jul 30, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JVM coverage report
|
languitar
force-pushed
the
feature/MODELIX-948-Prevent-duplication-of-the-Problem-type-in-spec-and-code
branch
2 times, most recently
from
July 4, 2024 18:47
e8c952a
to
136c046
Compare
Use a file $ref instead of duplicating the type to prevent potentially diverging definitions. This does not yet prevent the duplication of generated code.
languitar
force-pushed
the
feature/MODELIX-948-Prevent-duplication-of-the-Problem-type-in-spec-and-code
branch
2 times, most recently
from
July 30, 2024 11:58
3afedc5
to
be00722
Compare
odzhychko
requested changes
Jul 30, 2024
model-server-openapi/redocly-plugins/decorators/use-server-path.js
Outdated
Show resolved
Hide resolved
This commit makes the model-server-openapi folder a module again, which is now responsible for merging the individual OpenAPI specification files into a single one that's then used inside the build and for the SwaggerUI of the model-server. This has several benefits: * The SwaggerUI configuration and usage is easier as we present a single, combined API with a good overview under a single URL. * The duplicated generated of shared models such as the Problem type is prevented as the merging deduplicates the data type. Implementing merging is implemented with redocly, which was the only tool I could find for this tasks that worked. The model-server-openapi contains a decorator plugin for redocly that, as part of the merge process, prepends the server URL paths to routes so that URLs are correct in the merged result specification. The different specifications we maintain had a few duplicated response names that caused issues when merging. These duplications were resolved by renaming some instances of them. To properly categorize the different APIs in the SwaggerUI for the user, tags were added everywhere in the specifications. I could also get rid of several required imports by generating the source code into the same package that's also used for the API implementation.
languitar
force-pushed
the
feature/MODELIX-948-Prevent-duplication-of-the-Problem-type-in-spec-and-code
branch
from
July 30, 2024 13:28
2b10c51
to
6a32f39
Compare
odzhychko
previously approved these changes
Jul 30, 2024
Removes dependencies that are not explicitly required. The original reason for the additional dependencies was making ktlint tasks happy. But they have been dropped from the build.
languitar
force-pushed
the
feature/MODELIX-948-Prevent-duplication-of-the-Problem-type-in-spec-and-code
branch
from
July 30, 2024 14:04
6a32f39
to
1381ae2
Compare
odzhychko
approved these changes
Jul 30, 2024
languitar
deleted the
feature/MODELIX-948-Prevent-duplication-of-the-Problem-type-in-spec-and-code
branch
July 30, 2024 14:39
🎉 This PR is included in version 8.16.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes the model-server-openapi folder a module again, which
is now responsible for merging the individual OpenAPI specification
files into a single one that's then used inside the build and for the
SwaggerUI of the model-server. This has several benefits:
single, combined API with a good overview under a single URL.
prevented as the merging deduplicates the data type.
Implementing merging is implemented with redocly, which was the only
tool I could find for this tasks that worked. The model-server-openapi
contains a decorator plugin for redocly that, as part of the merge
process, prepends the server URL paths to routes so that URLs are
correct in the merged result specification.
The different specifications we maintain had a few duplicated response
names that caused issues when merging. These duplications were resolved
by renaming some instances of them.
To properly categorize the different APIs in the SwaggerUI for the user,
tags were added everywhere in the specifications.
I could also get rid of several required imports by generating the
source code into the same package that's also used for the API
implementation.
To be verified by reviewers