Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

API Studio making parameter required for specific REST calls

Not applicable

I have this YAML: http://playground.apistudio.io/6e0d3dca-4c4f-4c41-865c-b27eb39820f4/#/

It is consuming a public API, for tests.

In my definitions block I have Posts

Posts:
    properties:
      userId:
        type: integer
      title:
        type: string
      body:
        type: string	

None of the properties are required by default by I want to make them required when creating a new post on #26.

Is it possible to specify the required parameters when using a schema?

I have tried this:

    post:
      description: Criar um novo post
      parameters:
        - name: post
          in: body
          schema:
            "$ref": "#/definitions/Posts"

	required:
		- userId
			- title
		- body

I am trying to do that because in my PUT method, none of the fields are required, only the ones sent will be updated.

Thanks a lot!

0 2 496
2 REPLIES 2