A language for describing resource-oriented APIs & turning them into Swagger or resource diagrams. Oriented around the concepts we want to expose in the APIs.
Apache License 2.0
23
stars
7
forks
source link
Use Schemas Instead of Inline Pagination Reponses #181
As Jacob suggested, using schemas instead of inline definitions for the _pagination objects seems to solve this problem.
Previously, all the generated MultiReponses used the same TaxonomySyncRequestMultiResponsePagination. Now, each multi response has a pagination model defined for the same resource.
For example, in
specs-draft/taxonomy/generated/spring/src/main/java/com/liveramp/taxonomy/taxonomy_api/generated_spring/v1/model/TaxonomyFieldMultiResponse.java
58: public TaxonomyFieldMultiResponse pagination(TaxonomySyncRequestMultiResponsePagination pagination) {
is now
58: public TaxonomyFieldMultiResponse pagination(TaxonomyFieldMultiResponsePagination pagination) {
The ReDoc docs look the same and there are no changes in the OpenAPI spec outside expected _pagination changes when I use the new Reslang version locally.
The only real source changes were updating getPaginationResponse in src/swagger/pagination/index.ts and a small addition in src/genswagger.ts. The rest of the diff is updating tests and deleting unused code. The diff in models/pagination/testdata/swagger.expected demonstrates the effect on OpenAPI generation nicely.
@zapeterson16 and @JacobCrofts reported that pagination objects are shared in generated spring code when an API has more than one MULTIGETs: https://liveramp.slack.com/archives/CPBAEKS9X/p1612976567104700 https://github.com/LiveRamp/reslang/issues/178
As Jacob suggested, using schemas instead of inline definitions for the
_pagination
objects seems to solve this problem.Previously, all the generated
MultiReponse
s used the sameTaxonomySyncRequestMultiResponsePagination
. Now, each multi response has a pagination model defined for the same resource.For example, in
specs-draft/taxonomy/generated/spring/src/main/java/com/liveramp/taxonomy/taxonomy_api/generated_spring/v1/model/TaxonomyFieldMultiResponse.java
is now
The ReDoc docs look the same and there are no changes in the OpenAPI spec outside expected
_pagination
changes when I use the new Reslang version locally.The only real source changes were updating
getPaginationResponse
insrc/swagger/pagination/index.ts
and a small addition insrc/genswagger.ts
. The rest of the diff is updating tests and deleting unused code. The diff inmodels/pagination/testdata/swagger.expected
demonstrates the effect on OpenAPI generation nicely.