Forum Discussion

deepika_u95's avatar
deepika_u95
New Contributor
2 years ago

Query on Model, server response and openapi file

I was looking into petstore sample api, modified it a bit with oneOf, anyOf etc,. I have attached the yaml file.

 

When I POST with the below request body which has Dog properties “bark” and “breed” to /pet, I get 200 ok.

 

 

{
  "id": 111,
  "name": "doggie",
  "category": {
    "id": 1,
    "name": "Dogs"
  },
  "photoUrls": [
    "string"
  ],
  "tags": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "status": "available",
   "bark": true,
   "breed": "Dingo"
}

 

 

But when I do GET /pet/{petId} with id 111, I don’t get Dog properties “bark” and “breed” back from the server. I get the below response without Dog properties.

 

 

{
  "id": 111,
  "category": {
    "id": 1,
    "name": "Dogs"
  },
  "name": "doggie",
  "photoUrls": [
    "string"
  ],
  "tags": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "status": "available"
}

 

 

 

The reason for not getting the Dog properties is because, https://github.com/swagger-api/swagger-petstore/tree/master/src/main/java/io/swagger/petstore/model does not have Dog. Is that correct?

 

Looking forward for your response.

 

No RepliesBe the first to reply