Defining conditional attributes in OpenAPI
I need to define a request for a searching service in JSON. Request can have either geographical coordinates (longitude and latitude) or postal code. Either one must be present. If longitude is present, then latitude is required and vice versa. If both are omitted, postal code must be present. If geo coordinates present, postal code is optional (will be ignored if present). I am having trouble defining such request in swagger editor. If someone can help me, I will appreciate it greatly. We are using v.3.0.3 and the swagger file will be used to generate client code.SolvedOpenAPI and JSON-LD
Hello, Could you please tell me if OpenAPI supports the use of JSON-LD? I am using OpenAPI 3.0.1, and I am trying to include in the Schema some context information in order to add IRIs for objects/properties that are described in the Schema. If yes, are there any examples available? If not, do you know of any alternatives besides using x-<label>? Thank you very much for your help! FlorinaHow to get generate ZonedDateTime from OpenApi?
I am trying get `ZonedDateTime` in my generated code from OpenApi. There is a `If-Modified-Since` header that OpenApi generates on my endpoint but it's in the type of `LocalDateTime`. This is causing issues on my integration tests. task buildEndpointsFromYAML(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) { generatorName = "spring" inputSpec = acquirerYML outputDir = "$buildDir/generated".toString() groupId = "$project.group" id = "$project.name-java-client" version = "$project.version" apiPackage = "com.abc.xyz.apiEndpoints" modelPackage = "com.abc.xyz.apiModels" enablePostProcessFile = true skipOverwrite = false typeMappings = [ OffsetDateTime: "ZonedDateTime" ] importMappings = [ "java.time.OffsetDateTime" : "java.time.ZonedDateTime" ] configOptions = [ configPackage : "com.abc.xyz.apiEndpoints.config", java11 : "true", dateLibrary : "java8-localdatetime", serializationLibrary: "jackson", library : "spring-boot", useBeanValidation : "true", interfaceOnly : "true", serializableModel : "true", useTags : "true" ] } I've tried to some of the suggestions here too: https://stackoverflow.com/questions/56237650/use-java-time-instant-to-represent-datetime-instead-of-offsetdatetime but either it resulted in compilation errors or the type would go from `LocalDateTime` to `Object` as opposed to `ZonedDAteTime`. This is part of the swagger.yaml: parameters: - name: If-Modified-Since in: header description: If-Modified-Since required: false type: string format: date-time Thanks for any guidance!Mark parameters as "exclusive" in OpenAPI3.x ?
Does the OpenAPI specification have a provision to mark the listed parameters as exclusive, so a validation implementation would flag any additional submitted parameter as specification violation / invalid request? - Sorry if this would be the wrong place to ask.SolvedHow to define a secret key / signature based security scheme?
Skimming the Swagger documentation for authentication / authorization schemes in OAS 3.0, I don't see a clear way to define my API as utilizing signature-based authentication. I have an API where all requests must be passed two properties: `api_key` (which uniquely defines the user) and `signature` (which is computed using the request path, query string, and a secret key). The server keeps a copy of their secret key and generates the same signature using the same process, then compares the two signatures. This way unlike API key auth (where the full authentication credentials are passed over the internet, hopefully secured by HTTPS) there is never enough information passed for a man-in-the-middle to trivially forge requests (other than replay attacks using the exact same request). I feel like signature-based authentication isn't so rare as to be excluded from the OpenAPI specification. AWS uses signature-based authentication for almost all of their services! Is there a way to define this as a security scheme? Or is this a missing feature from the spec?Object property name as UUID
In the given API response how would you write the schema yaml to support UUIDs as a property name { "results": { "11b17cd8-0000-0000-0000-2092b242027f": [ { "id": "0000", "type": "Home", "ownership": "", "monthly": "0", "address_1": "23299 Address Parts", "address_2": "", "city": "Some City", "state": "ZZ", "zip": "00000", "active": "1", "primary": "1" } ] } } Here is my attempt (schema portion): components: schemas: uuid: type: string format: uuid description: UUID example: 00000000-0000-0000-0000-000000000000 pattern: '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' CustomerAddresses: type: object properties: '#/components/schemas/uuid': type: array items: $ref: '#/components/schemas/CustomerAddress' CustomerAddress: type: object properties: id: type: string example: "3014" type: type: string enum: ['Home', 'Work'] ownership: type: string example: "" monthly: type: string example: "0" address_1: type: string example: "23444 Address Parts" address_2: type: string example: "Unit 42" city: type: string example: "Some City" state: type: string maxLength: 2 minLength: 2 example: "ZZ" zip: type: string format: int32 example: "00000" active: type: string enum: ["0", "1"] primary: type: string enum: ["0", "1"]Solved