-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Incorrect swagger definition for models with forceId:true #2924
Comments
The petstore example shows the approach we can use too. https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v2.0/yaml/petstore-expanded.yaml Check out their POST /addPet - it takes a body of type NewPet. GET /pet returns a type Pet, which is allOf NewPet, plus id. |
Instead of hard-coding detection of |
This is not a blocker for 3.x because we can fix this in the swagger generator. |
Similarly, we need to specify that |
This issue is producing a 422 error in the Testing a LoopBack project tutorial. It is causing confusion for the customers. Any chance it could get fixed? |
@bschrammIBM Thank you for bringing this issue into our attention. Could you please give us the link to "Testing a LoopBack project tutorial" you have mentioned? @raymondfeng @ritch @kjdelisle ping |
Here is the tutorial mentioned:
https://www.ibm.com/support/knowledgecenter/SSMNED_5.0.0/com.ibm.apic.toolkit.doc/tutorial_cli_project_test.html
I have added the following note which will be in a future release of the Knowledge Center (unless this issue gets fixed!):
The generated data sample requires editing in order to produce a sample response. Remove the line for "id" and the comma at the end of the previous line. The sample code will look similar to the following: { "type":"ATM", "phone":"(854)509-3813"}
Yours,
Barbara
----- Original message -----From: Miroslav Bajtoš <[email protected]>To: strongloop/loopback <[email protected]>Cc: bschrammIBM <[email protected]>, Mention <[email protected]>Subject: Re: [strongloop/loopback] Incorrect swagger definition for models with forceId:true (#2924)Date: Thu, May 25, 2017 8:22 AM
@bschrammIBM Thank you for bringing this issue into our attention. Could you please give us the link to "Testing a LoopBack project tutorial" you have mentioned?
@raymondfeng @ritch @kjdelisle ping
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.
|
@bajtos I agree with this solution 👍 , how about name the flag as |
@bschrammIBM Thanks! I will work on the fix asap |
Task:
|
I am afraid this issue is more complex.
|
Sorry that I might be new to this topic... From the documentation, https://loopback.io/doc/en/lb3/Embedded-models-and-relations.html, I thought Unless we want to specify this kind of behavior beyond |
@dhmlau I believe this is a different It's unfortunate that it has the same name as the top-level |
From @bajtos
|
|
Making it to 8 points based on the issue found during the review and left over work |
Will be closing this issue since all the PRs for this feature are merged and published to npm
@bschrammIBM please open a doc issue to remove the workaround added in the documentation which talks about removing the 'id" field explicitly from the JSON input to avoid validation error. @bajtos wondering if API designer picks up latest version of this from npm or it needs to change anything from the designer side (loopback-workspace version?) to pick up latest version from npm? |
IIRC, API Connect locks down the dependencies to the latest version at the time a new APIC version is published. In which case a new release of |
Since @bschrammIBM is on vacation atm, I created the doc issue https://github.ibm.com/apimesh/apiconnect-docs/issues/395. |
Per @crandmck 's comment, assign this to @bschrammIBM as well. |
@rashmihunt |
Description of feature (or steps to reproduce if bug)
The swagger specification generated for LoopBack models with
forceId
set totrue
(the default in LoopBack 3.0) is incorrect. The model definition marks theid
property as required, but thecreate
operation is rejecting requests withid
property set.This causes problems in API Connect, where the sample request data generated by Editor contains
id
now.Expected result
The sample request generated by APIC Editor for
create
operation does not containid
property.Actual result (if bug)
The sample request generated by APIC Editor for
create
operation containsid
property.Additional information (Node.js version, LoopBack version, etc)
The default value of
forceId
was changed totrue
in LoopBack 3.0 for security reasons, see loopbackio/loopback-datasource-juggler#982 and loopbackio/loopback-datasource-juggler#849The text was updated successfully, but these errors were encountered: