Skip to content

Commit

Permalink
add new example for oneof discriminator lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreatma committed Jan 17, 2025
1 parent e00a7f0 commit a24a8ec
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/configs/go-oneof-discriminator-lookup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
generatorName: go
outputDir: samples/client/others/go/oneof-discriminator-lookup
inputSpec: modules/openapi-generator/src/test/resources/3_0/go/spec-with-oneof-discriminator.yaml
additionalProperties:
useOneOfDiscriminatorLookup: "true"
hideGenerationTimestamp: "true"
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
openapi: 3.0.0
info:
title: Test
version: 1.0.0
paths: {}
components:
schemas:
NestedObject1:
required:
- field1
properties:
field1:
description: Specifies an action name to be used with the Android Intent class.
type: string
type:
type: string
NestedObject2:
required:
- field2
properties:
field1:
description: Specifies an action name to be used with the Android Intent class.
type: string
type:
type: string
Object:
oneOf:
- $ref: '#/components/schemas/NestedObject1'
- $ref: '#/components/schemas/NestedObject2'
discriminator:
propertyName: type
mapping:
ONE: '#/components/schemas/NestedObject1'
TWO: '#/components/schemas/NestedObject2'

0 comments on commit a24a8ec

Please sign in to comment.