Fix remoting metadata for "data" arguments [2.x] - #2702
Merged
Conversation
This was referenced Sep 2, 2016
Contributor
|
@bajtos The code change LGTM. But does this code need to be in 3.x? |
Member
Author
I'll forward-port to 3.x later. I started with a patch sent against 2.x to see how downstream dependencies are handling the change. There are very few dependents using LooBack 3.x. It has happened to us very recently that we landed a patch to 3.x because all looked well and then there was a bunch failures after back-porting to 2.x |
Fix the definition of "data" argument to
{ type: 'object', model: modelName, ... }
That way strong-remoting passed the request body directly to the model
method (does not create a new model instance), but the swagger will
still provide correct schema for these arguments.
This fixes a bug where upsert in relation methods was adding default
property values to request payload.
bajtos
force-pushed
the
fix/data-object-arguments
branch
from
September 7, 2016 11:00
70f50af to
fcfdb73
Compare
Member
Author
|
I compared swagger documents produced before this patch and after this patch. The only difference is that with this patch in place, the responses for relation methods include the description from remoting metadata, which is a good thing IMO. (...)
@@ -267,6 +270,7 @@
description: Model instance data
required: false
schema:
+ description: Model instance data
$ref: '#/definitions/Category'
responses:
'200':
@@ -373,6 +377,7 @@
description: An object of model property name/value pairs
required: false
schema:
+ description: An object of model property name/value pairs
$ref: '#/definitions/Category'
- name: id
in: path
@@ -399,6 +404,7 @@
(...) |
This file contains hidden or 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
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.
Fix the definition of "data" argument to
That way strong-remoting passed the request body directly to the model
method (does not create a new model instance), but the swagger will
still provide correct schema for these arguments.
This fixes a bug where upsert in relation methods was adding default
property values to request payload.
Connect to #1806
Requires also strongloop/loopback-swagger#55 to be released around the same time
@0candy please review
This patch clashes with #2539 which is in review too. We need to rebase the second patch to be landed after the first one is merged.