Closed dickermoshe closed 4 months ago
Example Schema
swagger: '2.0' info: description: "This spec is for testing rust-server-specific things" version: 2.3.4 title: rust-server-test schemes: - http paths: /dummy: get: summary: A dummy endpoint to make the spec valid. operationId: dummyGet responses: '200': description: Success put: operationId: dummyPut parameters: - $ref: '#/parameters/nested_response' responses: '200': description: Success /html: post: summary: Test HTML handling consumes: [text/html] produces: [text/html] operationId: htmlPost parameters: - in: body name: body required: true schema: type: string responses: 200: description: Success schema: type: string /file_response: get: summary: Get a file operationId: file_responseGet produces: - application/json responses: 200: description: Success schema: type: file /raw_json: get: summary: Get an arbitrary JSON blob. operationId: raw_jsonGet responses: 200: description: Success schema: type: object /solo-object: post: summary: Send an arbitrary JSON blob operationId: solo_objectPost consumes: - application/json parameters: - name: value in: body required: true schema: type: object responses: '204': description: OK /post-yaml: post: description: Test sending an arbitrary unsupported format - e.g. YAML operationId: post_yaml consumes: - application/yaml parameters: - name: value description: The YAML body to test in: body required: true schema: type: string responses: '204': description: OK /get-structured-yaml: get: description: Test returning arbitrary structured YAML operationId: getStructuredYaml produces: - application/yaml responses: '200': description: OK schema: $ref: '#/definitions/get_yaml_response' /allOf: get: description: Test getting an object which uses allOf operationId: AllOf_Get responses: '200': description: OK schema: $ref: '#/definitions/allOfObject' parameters: nested_response: name: nested_response in: body required: true schema: # Erroneously ends up as `Option<models::InlineObject>` properties: id: type: string password: type: string required: - id definitions: additionalPropertiesObject: description: An additionalPropertiesObject type: object additionalProperties: type: string example: "foo" allOfObject: properties: sampleProperty: type: string allOf: - $ref: '#/definitions/baseAllOf' baseAllOf: type: object properties: sampleBaseProperty: type: string aNullableContainer: type: object properties: NullableThing: type: string x-nullable: true RequiredNullableThing: type: string x-nullable: true required: - RequiredNullableThing ObjectOfObjects: description: An object of objects type: object properties: inner: type: object required: - required_thing properties: required_thing: type: string optional_thing: type: integer get_yaml_response: description: structured response type: object properties: value: description: Inner string type: string # Currently broken - see https://github.com/OpenAPITools/openapi-generator/issues/8 # ArrayOfObjects: # description: An array of objects # type: array # items: # properties: # filename: # description: A non-required property # type: string # contents: # description: A required property # type: string # required: # - contents # type: object
Example Schema