Questions tagged [anyof]

6 questions
2
votes
0 answers

How to add multiple examples to a Swagger schema?

I'm using Swagger with OAS3, since I need anyOf support. I have an API call that can take one of 2 possible schemas, an account or an address. The schema works well in Swagger: it shows, and validates. But the example value shows only the first…
Traveling Tech Guy
  • 27,194
  • 23
  • 111
  • 159
1
vote
0 answers

json schema: how to specify schema for array with two object types and min/max occurance for each type

I would like to define a JSON schema for an array that can contain two different objects (type A and type B). Only exactly the following combinations should be allowed: [ A ] [ A, B ] [ B, A ] [ B ] my current schema draft "myArray": { "type":…
1
vote
0 answers

Can we force Swagger to "inline" objects in "anyOf" instead of using $ref to an object when generating an openapi docs

I am wondering if there is a way to force Swagger and Spring (maybe using annotations?) to "inline" objects when generating openapi docs. An example of how it works right now: paths: /pets: patch: requestBody: content: …
kuba12
  • 255
  • 1
  • 4
  • 15
1
vote
0 answers

Protobuf use repeated oneof message vs many empty fields

I'm designing a protobuf to represent an event, where each event can hold extra fields. There are a lot of possible extra fields (~100), but only a small portion of them will be used in each message (~3) Each extra field will be used only once, but…
1
vote
1 answer

Cross-dependency of attributes in OpenAPI 3.0

I need to define swagger/OpenAPI v 3.0 file for a search API. My request can specify either geospatial coordinates (longitude and latitude) or (postal code and country code) or (city and state and country code). Beside these I do have couple more…
Gary Greenberg
  • 468
  • 1
  • 9
  • 22
0
votes
1 answer

How to use "anyOf" in JSON schema validation which is using RAML and MULE API?

I need to implement schema validation for incoming JSON payload. The below elements will be there in the JSON, "partyId": { "type": ["string","null"], "maxLength": 16, "required": false, …