Skip to content
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

Request body is not preloaded with example data when the schema has nested objects #2415

Open
sankarshan-nous opened this issue Feb 20, 2024 · 2 comments
Labels
(t) Feature request Requests for new functionality and features.

Comments

@sankarshan-nous
Copy link

The sample request body is not preloaded for few post/put requests which are having nested schema references. I tried by adding sample request under design menu of the endpoint but that does not reflect in the APIM.

APIM-Post

Below is the example request schema which is used for the post request. I am expecting the APIM to generate example request object in the body of the request.

"RequestDto": {
"type": "object",
"properties": {
"email": {
"type": "string",
"nullable": true
},
"firstName": {
"type": "string",
"nullable": true
},
"lastName": {
"type": "string",
"nullable": true
},
"mobileNumber": {
"type": "string",
"nullable": true
},
"startDate": {
"type": "string",
"format": "date-time",
"nullable": true
},
"endDate": {
"type": "string",
"format": "date-time",
"nullable": true
},
"inviteCommunicationMethod": {
"$ref": "#/components/schemas/CommunicationMethod"
},
"userId": {
"type": "string",
"format": "uuid",
"nullable": true
},
"companyId": {
"type": "string",
"format": "uuid",
"nullable": true
},
"business": {
"$ref": "#/components/schemas/Business"
},
"requestType": {
"$ref": "#/components/schemas/RequestType"
},
"personalDataDto": {
"$ref": "#/components/schemas/PersonalDataDto"
}
},
"additionalProperties": false
},

@malincrist
Copy link
Member

hello @sankarshan-nous , thanks for reaching out.
I'm not able to reproduce the issue you are describing.

I added a response with the schema you provided and then generated a sample from Azure Portal:
image

then, this sample is loaded in developer portal
image

@sankarshan-nous
Copy link
Author

Oh sorry. I mentioned it wrong. It does generate a sample request when I have already added an example under design. What I am expecting is to give a sample request body to the user when sending a request without adding sample request under design manually.
The confusion is APIM provides sample request body preloaded for few Api's but not for all. One of the cases I observed was for the schema I shared earlier. Shouldn't it generate automatically under "Try it" section even if it is not generated under design? Because to add the sample request body manually under design will be a huge task for all endpoints/applications.

@malincrist malincrist added the (t) Feature request Requests for new functionality and features. label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(t) Feature request Requests for new functionality and features.
Projects
None yet
Development

No branches or pull requests

2 participants