0

I have a rest service, that can work as below:

http://server/path/AddressResource and

http://server/path/AddressResource/someAnotherPath

I have a definitions like below.

"definitions": {
    "address": {
      "type": "object",
      "properties": {
        "street_address": { "type": "string" },
        "city":           { "type": "string" },
        "state":          { "type": "string" }
      },
      "required": ["street_address", "city", "state"]
    }
  }

that is the response of path1, and in path two i just want to return the "city" property of address.

Can I create a schema, referring to address and using just one of it's property?

Optional
  • 4,387
  • 4
  • 27
  • 45
  • You're going to need to provide more information, Please include all scheams, and explain what you want to achive. – Relequestual Apr 04 '18 at 12:23
  • How is this releated to swagger? Are you defining your API using swagger / OAPI? – Relequestual Apr 04 '18 at 12:24
  • Does the 2nd path return `{"city": "London"}` or just the string `"London"`? – Helen Apr 04 '18 at 12:30
  • @Relequestual Yes to question on swagger. Not sure what more shall i add to schema. @Helen It returns `{"city": "London"}` – Optional Apr 04 '18 at 12:40
  • your response for the first path is a schema or data? it's unclear. – Relequestual Apr 04 '18 at 12:45
  • Possible duplicate of [Creating an extendible model using Swagger/ OpenAPI](https://stackoverflow.com/questions/42496266/creating-an-extendible-model-using-swagger-openapi) – Helen Apr 04 '18 at 13:10

0 Answers0