I've created a specification that has objects with enum values. Some methods should support all enum values and therefore I thought just to put the enum objects as allOf reference, however that doesn't seems to be working.
In the example below the EnumObject class doesn't contain any values, while the EnumObjectA and EnumObjectB are working as expected.
openapi: 3.0.3
info:
title: Test spec for StackOverflow
version: 1.0.0
paths:
/status:
get:
tags:
- Test
summary: Test summary
description: 'Test description'
operationId: testOperationId
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/TestResponse'
components:
schemas:
TestResponse:
type: object
properties:
stringId:
type: string
enumObject:
$ref: '#/components/schemas/EnumObject'
EnumObject:
allOf:
- $ref: '#/components/schemas/EnumObjectA'
- $ref: '#/components/schemas/EnumObjectB'
EnumObjectA:
type: string
description: Enum object A
enum:
- VALUE_A1
- VALUE_A2
EnumObjectB:
type: string
description: Enum object B
enum:
- VALUE_B1
- VALUE_B2
- VALUE_B3
I'm using the following configuration within the openapi-generator-maven-plugin
. If this feature not supported or am I missing something?
<configuration>
<inputSpec>${project.basedir}/src/main/resources/openapi/rest.yaml</inputSpec>
<generatorName>jaxrs-spec</generatorName>
<configOptions>
<dateLibrary>java8</dateLibrary>
<interfaceOnly>true</interfaceOnly>
<useTags>true</useTags>
</configOptions>
<generateApiTests>false</generateApiTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelTests>false</generateModelTests>
<generateModelDocumentation>false</generateModelDocumentation>
<generateSupportingFiles>false</generateSupportingFiles>
<ignoreFileOverride>${project.basedir}/src/main/resources/.openapi-codegen-ignore</ignoreFileOverride>
</configuration>