What are the Slack Archives?
It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hi, I'm trying to create openapi java clients for the spryker glue api using the openapi generator (
Hi, I'm trying to create openapi java clients for the spryker glue api using the openapi generator (https://openapi-generator.tech/). It works so far and I can access the glue API with Java. But it seems that there is a mismatch in the schema for getting carts. The swagger API specifies relationships within cart/data like this:
"relationships": { "concrete-products": [ { "id": "string", "type": "string" } ] }
But when I use postman to test the cart API, I get for example this:
"relationships": { "items": { "data": [ { "type": "items", "id": "5077365" }, { "type": "items", "id": "5580599" } ] } }
Therefore my java client gets an empty relationships object, because "concrete-products" does not match "items/data". Does anybody know why "concrete-products" is mapped to "items/data"?
Comments
-
Hi Matthias.
It looks like the generated documentation is wrong about the
carts
resource being related toconcrete-products
.I will open a bug in core to fix this in the generator tool.
What the relationships of the
carts
should really look like is:RestCartsRelationships: properties: cart-permission-groups: items: $ref: '#/components/schemas/RestRelationships' shared-carts: items: $ref: '#/components/schemas/RestRelationships' items: items: $ref: '#/components/schemas/RestRelationships'
then the
items
should get theconcrete-products
relationship (the whole schema for theitems
is missing, but once fixed) should look like this:RestItemsResponse: properties: data: $ref: '#/components/schemas/RestItemsResponseData' links: $ref: '#/components/schemas/RestLinks' RestItemsResponseData: properties: type: type: string id: type: string attributes: $ref: '#/components/schemas/RestItemsAttributes' links: $ref: '#/components/schemas/RestLinks' relationships: $ref: '#/components/schemas/RestItemsRelationships' RestItemsAttributes: properties: sku: type: string quantity: type: number groupKey: type: string abstractSku: type: string amount: type: number calculations: $ref: '#/components/schemas/RestCartItemCalculations' RestCartItemCalculations: properties: unitPrice: type: number sumPrice: type: number taxRate: type: number unitNetPrice: type: number sumNetPrice: type: number unitGrossPrice: type: number sumGrossPrice: type: number unitTaxAmountFullAggregation: type: number sumTaxAmountFullAggregation: type: number sumSubtotalAggregation: type: number unitSubtotalAggregation: type: number unitProductOptionPriceAggregation: type: number sumProductOptionPriceAggregation: type: number unitDiscountAmountAggregation: type: number sumDiscountAmountAggregation: type: number unitDiscountAmountFullAggregation: type: number sumDiscountAmountFullAggregation: type: number unitPriceToPayAggregation: type: number sumPriceToPayAggregation: type: number RestItemsRelationships: properties: concrete-products: items: $ref: '#/components/schemas/RestRelationships'
Same would apply for
guest-carts
resource.0 -
Thanks a lot for your quick answer!
0 -
I just found another bug of the same type. This time it's the getCustomers API. The data object contains something like this
"relationships": { "addresses": { "data": [ { "type": "addresses", "id": "31bb0ae4-ea88-5a7d-b580-90b12b1ba6c2" } ] } }
But the specification says this:
"relationships": { "addresses": [ { "id": "string", "type": "string" } ],
This breaks any openapi/swagger generated clients (again).
My guess is that there are more of these bugs in the glue API....0 -
Another bug created. Thank you for your feedback.
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random