Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions examples/anyof-allof-oneof/anyofallofoneof.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/anyof-allof-oneof/cfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ generate:
output-options:
# NOTE that this is only required for the `Unreferenced` type
skip-prune: true
overlay:
path: overlay.yaml
11 changes: 11 additions & 0 deletions examples/anyof-allof-oneof/overlay.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
overlay: 1.0.0
info:
title: "Example to indicate how to use the OpenAPI Overlay specification (https://github.com/OAI/Overlay-Specification)"
version: 1.0.0
actions:
- target: $.components.schemas.Client
update:
x-go-type: OverlayClient
- target: $.components.schemas.ClientWithId
update:
x-go-type: OverlayClientWithId
12 changes: 12 additions & 0 deletions examples/anyof-allof-oneof/overlays.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package anyofallofoneof

// OverlayClient defines model for OverlayClient.
type OverlayClient struct {
Name string `json:"name"`
}

// OverlayClientWithId defines model for OverlayClientWithId.
type OverlayClientWithId struct {
Id int `json:"id"`
Name string `json:"name"`
}
17 changes: 17 additions & 0 deletions examples/anyof-allof-oneof/overlays_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package anyofallofoneof

import "testing"

func TestAllOfOverlay(t *testing.T) {
var inner any = Client{}
_, ok := inner.(OverlayClient)
if !ok {
t.Errorf("expected Client to be of type OverlayClient")
}

var outer any = ClientWithId{}
_, ok = outer.(OverlayClientWithId)
if !ok {
t.Errorf("expected ClientWithId to be of type OverlayClientWithId")
}
}