Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix for requestBody and parameters #27

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

Closed
jhaagmans wants to merge 1 commit into temando:master from jhaagmans:feature/fix-parameters

Conversation

Copy link

@jhaagmans jhaagmans commented Aug 9, 2018
edited
Loading

Edited the original fix by @David-Sellen (#24) to support parameters again. Hope this can get merged soon, as an important part of what we use this plugin for (parameter and request body documentation) now doesn't work.

@kzhou57 kzhou57 mentioned this pull request Aug 9, 2018
Copy link

kzhou57 commented Aug 9, 2018

Tested it, it doesn't sound working.

Copy link
Author

jhaagmans commented Aug 10, 2018
edited
Loading

Could you elaborate? Running the example serverless.yml with the current version of the npm package yields:

openapi: 3.0.0
components:
 schemas:
 PutDocumentRequest:
 properties:
 SomeObject:
 type: object
 properties:
 SomeAttribute:
 type: string
 securitySchemes: {}
info:
 title: ''
 description: ''
 version: 712334c8-7b29-46c5-9e93-cd7acb6b8825
paths:
 /create:
 post:
 operationId: createUser
 summary: Create User
 description: Creates a user and then sends a generated password email
 responses:
 '201':
 description: A user object along with generated API Keys
 content:
 application/json:
 schema:
 $ref: '#/components/schemas/PutDocumentResponse'
 '500':
 description: An error message when creating a new user
 content:
 application/json:
 schema:
 $ref: '#/components/schemas/ErrorResponse'

Mind that all parameters and the RequestBody are missing.

With this fix, this is the result:

openapi: 3.0.0
components:
 schemas:
 ErrorResponse:
 title: JSON API Schema
 description: >-
 This is a schema for responses in the JSON API format. For more, see
 http://jsonapi.org
 type: object
 required:
 - errors
 properties:
 errors:
 type: array
 items:
 type: object
 properties:
 id:
 description: >-
 A unique identifier for this particular occurrence of the
 problem.
 type: string
 links:
 description: >-
 A resource object **MAY** contain references to other resource
 objects ("relationships"). Relationships may be to-one or
 to-many. Relationships can be specified by including a member
 in a resource's links object.
 type: object
 properties:
 self:
 description: >-
 A `self` member, whose value is a URL for the relationship
 itself (a "relationship URL"). This URL allows the client
 to directly manipulate the relationship. For example, it
 would allow a client to remove an `author` from an
 `article` without deleting the people resource itself.
 type: string
 format: uri
 related:
 description: >-
 A link **MUST** be represented as either: a string
 containing the link's URL or a link object.
 oneOf:
 - description: A string containing the link's URL.
 type: string
 format: uri
 - type: object
 required:
 - href
 properties:
 href:
 description: A string containing the link's URL.
 type: string
 format: uri
 meta:
 description: >-
 Non-standard meta-information that can not be
 represented as an attribute or relationship.
 type: object
 additionalProperties: true
 additionalProperties: true
 status:
 description: >-
 The HTTP status code applicable to this problem, expressed as
 a string value.
 type: string
 code:
 description: >-
 An application-specific error code, expressed as a string
 value.
 type: string
 title:
 description: >-
 A short, human-readable summary of the problem. It **SHOULD
 NOT** change from occurrence to occurrence of the problem,
 except for purposes of localization.
 type: string
 detail:
 description: >-
 A human-readable explanation specific to this occurrence of
 the problem.
 type: string
 source:
 type: object
 properties:
 pointer:
 description: >-
 A JSON Pointer [RFC6901] to the associated entity in the
 request document [e.g. "/data" for a primary data object,
 or "/data/attributes/title" for a specific attribute].
 type: string
 parameter:
 description: >-
 A string indicating which query parameter caused the
 error.
 type: string
 meta:
 description: >-
 Non-standard meta-information that can not be represented as
 an attribute or relationship.
 type: object
 additionalProperties: true
 additionalProperties: false
 uniqueItems: true
 meta:
 description: >-
 Non-standard meta-information that can not be represented as an
 attribute or relationship.
 type: object
 additionalProperties: true
 links:
 description: >-
 A resource object **MAY** contain references to other resource
 objects ("relationships"). Relationships may be to-one or to-many.
 Relationships can be specified by including a member in a resource's
 links object.
 type: object
 properties:
 self:
 description: >-
 A `self` member, whose value is a URL for the relationship
 itself (a "relationship URL"). This URL allows the client to
 directly manipulate the relationship. For example, it would
 allow a client to remove an `author` from an `article` without
 deleting the people resource itself.
 type: string
 format: uri
 related:
 description: >-
 A link **MUST** be represented as either: a string containing
 the link's URL or a link object.
 oneOf:
 - description: A string containing the link's URL.
 type: string
 format: uri
 - type: object
 required:
 - href
 properties:
 href:
 description: A string containing the link's URL.
 type: string
 format: uri
 meta:
 description: >-
 Non-standard meta-information that can not be
 represented as an attribute or relationship.
 type: object
 additionalProperties: true
 additionalProperties: true
 additionalProperties: false
 PutDocumentResponse:
 title: Empty Schema
 type: object
 PutDocumentRequest:
 properties:
 SomeObject:
 type: object
 properties:
 SomeAttribute:
 type: string
 securitySchemes: {}
info:
 title: ''
 description: ''
 version: e9860c9e-d888-47fc-9068-6094d45e0550
paths:
 '/create/{username}':
 post:
 operationId: createUser
 summary: Create User
 description: Creates a user and then sends a generated password email
 requestBody:
 content:
 application/json:
 schema:
 $ref: '#/components/schemas/PutDocumentRequest'
 description: A user information object
 parameters:
 - name: username
 in: path
 description: The username for a user to create
 required: true
 schema:
 type: string
 pattern: '^[-a-z0-9_]+$'
 - name: membershipType
 in: query
 description: The user's Membership Type
 required: false
 allowEmptyValue: false
 schema:
 type: string
 enum:
 - premium
 - standard
 - name: SessionId
 in: cookie
 description: A Session ID variable
 required: false
 schema:
 type: string
 responses:
 '201':
 description: A user object along with generated API Keys
 content:
 application/json:
 schema:
 $ref: '#/components/schemas/PutDocumentResponse'
 '500':
 description: An error message when creating a new user
 content:
 application/json:
 schema:
 $ref: '#/components/schemas/ErrorResponse'

What did you test and what did your test yield? The only thing this PR is targeted at, is making sure the RequestBody and parameters are working again.

You probably need to fix the pathParameter in the example, as there is no actual pathParameter in the example path, but the error for that is clear.

Copy link

I can also confirm that *params and the requestModel properties are being ignored in the serverless.yml configuration. The DefinitionGenerator needs to check for a value in the documentationConfig, not the being-generated operationObj.

@arnonki arnonki mentioned this pull request Aug 27, 2018
Copy link

@nfour Any chance you can look into this further? It seems like a lot of users are running into this blocker.

Copy link
Collaborator

nfour commented Aug 30, 2018

@adambartholomew

This repo has naturally regressed into a state of deprecation as we at Temando have decided not to make use of this plugin.

The reasoning being that it is undesirable to couple directly to Serverless and instead we've opted for other Open Api generation methods.

I'd recommend someone forks the project and publishes a new package as I don't see us putting effort into this plugin going forward.

Sorry :(

adambartholomew, sandeep-datman, and gndelia reacted with thumbs up emoji gndelia reacted with confused emoji

Copy link

If this plugin is deprecated then you should update the repo Read Me and you should advise Serverless to stop linking to this plugin.

jweyrich, RGunning, hdev14, gabbrieu, Melv, and kblackballer0610 reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
1 more reviewer

@adambartholomew adambartholomew adambartholomew left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /