OpenAPITools/openapi-generator
Voir sur GitHub[Java] Add proper support for allOf anyOf oneOf
Open
#634 ouverte le 24 juil. 2018
Client: JavaEnhancement: FeatureFeature: Composition / InheritanceHacktoberfestServer: Javahelp wanted
Métriques du dépôt
- Stars
- (26 243 stars)
- Métriques de merge PR
- (Merge moyen 9j 1h) (123 PRs mergées en 30 j)
Description
Description
In the openApiSpec it is possible to define a schema with properties, where one property can be defined directly or be using oneOf anyOf or allOf and passing the some provided Schemas.
Currently only allOf is considered and only the first of these schemas is taken (allOf requires all of them!). The other two delimiter are not even considered.
The following example makes it only possible to set the CustomProperties.
openapi-generator version
3.1.1
OpenAPI declaration file content or url
Sample Snippet.:
info:
title: test
version: 1.0.0
paths:
/test:
get:
responses:
'200':
description: All good
content:
'*/*':
schema:
$ref: '#/components/schemas/ObjectWithProps'
operationId: get
summary: Get object with properties.
components:
schemas:
ObjectWithProps:
properties:
properties:
allOf:
- $ref: '#/components/schemas/CustomProperties'
- $ref: '#/components/schemas/Properties'
description: An object with difined and undifined keys.
CustomProperties:
description: The custom properties key.
type: object
properties:
'someDefinedKey':
type: object
additionalProperties:
type: object
Properties:
description: The wildcard properties key.
type: object
additionalProperties:
type: object
openapi: 3.0.0
Steps to reproduce
java -jar ${PathToOpenApiGeneratorJAR3.1.1} generate \
-i /path/swagger3.yaml \
-o /path/swagger3-client \
--api-package "com.123" \
--model-package "com.123" \
--group-id "com.123" \
--artifact-id "123" \
--artifact-version "SNAPSHOT" \
-c ./java-options.json \
-g java
JavaOptions:
{
"java8": true,
"dateLibrary": "java8"
}