Skip to content

Parameter only for POST #2864

Closed
Closed

Description

@DenisFerrero

I have a schema that I would like to use for both POST and PUT methods but a target parameter is allowed only for the POST request.

To make it clear let's imagine that there is a possibility to create and update a user.
At the POST it's required the name and the inviteCode, then for the PUT just the name and don't allow to edit the inviteCode anymore

components:
  schemas:
    user:
      type: object
      properties:
        name:
          type: string
        inviteCode:
          type: string
paths:
  "/user":
    post:
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/user"
  "/user/{id}":
    put:
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/user"

Is there a way to do it by just adding a parameter to the inviteCode?

Activity

  1. locked and limited conversation to collaborators on Jan 26, 2022
  2. converted this issue into a discussion #2865 on Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions