How to send the Default value through body in Swagger 2.0
See original GitHub issueHi i am trying to send the Default values through body parameters but its Not taking while Submitting. can anybody please help me on this issue. Here is my code and i am trying to send the default name parameter through body
swagger: '2.0'
info:
version: 1.0.0
title: PetStore on Heroku
description: |
**This example has a working backend hosted in Heroku**
You can try all HTTP operation described in this Swagger spec.
Find source code of this API [here](https://github.com/mohsen1/petstore-api)
host: petstore-api.herokuapp.com
basePath: /pet
schemes:
- http
- https
consumes:
- application/json
- text/xml
produces:
- application/json
- text/html
paths:
/:
get:
parameters:
- name: limit
in: query
description: number of pets to return
type: integer
default: 0
responses:
200:
description: List all pets
schema:
title: Pets
type: array
items:
$ref: '#/definitions/Pet'
post:
parameters:
- name: pet
in: body
description: The pet JSON you want to post
schema:
$ref: '#/definitions/Pet'
required: true
responses:
200:
description: Make a new pet
put:
parameters:
- name: pet
in: body
description: The pet JSON you want to post
schema:
$ref: '#/definitions/Pet'
required: true
responses:
200:
description: Updates the pet
/{petId}:
get:
parameters:
- name: petId
in: path
type: string
description: ID of the pet
required: true
responses:
200:
description: Sends the pet with pet Id
definitions:
Pet:
type: object
properties:
name:
type: string
default : "xxxxxxx"
birthday:
type: integer
format: int32
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:11 (6 by maintainers)
Top Results From Across the Web
How to send the Default value through body in Swagger 2.0
The default value should be handled in the server side as the server should not always assume the client sends HTTP requests that...
Read more >Describing Request Body - Swagger
The POST, PUT and PATCH requests can have the request body (payload), such as JSON or XML data. In Swagger terms, the request...
Read more >Describing Parameters - Swagger
A constant parameter is always sent by the client, whereas the default value is something that the server uses if the parameter is...
Read more >OpenAPI Specification - Version 2.0 - Swagger
This is valid only for either query or formData parameters and allows you to send a parameter with a name only or an...
Read more >Describing Parameters - Swagger
An API call may require that custom headers be sent with an HTTP request. Swagger lets you define custom request headers as in:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@Alin-Barsan I’m not really sure what you mean by ‘web view’ - don’t know which project you’re referring to. However, by the sound of what you’re describing, again, this is not related to swagger-core. Please open a ticket on whichever project you experience the issue with.
@jeevanhr7 In swagger 2.0 for body parameters default value is set by “example” keyword