Skip to content

Commit dcc81e1

Browse files
committed
Fix tests.
1 parent 2075730 commit dcc81e1

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

internal/generate/test_utils/types_output

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@ type DiskCreate struct {
1111
DiskSource DiskSource `json:"disk_source,omitempty" yaml:"disk_source,omitempty"`
1212
}
1313

14-
func (DiskCreate) isDiskCreate() {}
15-
1614
// DiskIdentifier is parameters for the [`Disk`](omicron_common::api::external::Disk) to be attached or
1715
// detached to an instance
1816
type DiskIdentifier struct {
1917
Name Name `json:"name,omitempty" yaml:"name,omitempty"`
2018
}
2119

22-
func (DiskIdentifier) isDiskIdentifier() {}
23-
2420
// DiskSourceType is the type definition for a DiskSourceType.
2521
type DiskSourceType string
2622
// DiskSourceSnapshot is create a disk from a disk snapshot
@@ -29,16 +25,12 @@ type DiskSourceSnapshot struct {
2925
Type DiskSourceType `json:"type,omitempty" yaml:"type,omitempty"`
3026
}
3127

32-
func (DiskSourceSnapshot) isDiskSourceSnapshot() {}
33-
3428
// DiskSourceImage is create a disk from a project image
3529
type DiskSourceImage struct {
3630
ImageId string `json:"image_id,omitempty" yaml:"image_id,omitempty"`
3731
Type DiskSourceType `json:"type,omitempty" yaml:"type,omitempty"`
3832
}
3933

40-
func (DiskSourceImage) isDiskSourceImage() {}
41-
4234
// DiskSource is the type definition for a DiskSource.
4335
type DiskSource struct {
4436
// SnapshotId is the type definition for a SnapshotId.

internal/generate/types_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,10 @@ func Test_createOneOf(t *testing.T) {
273273
},
274274
},
275275
{
276-
Description: "// ImageSource is the source of the underlying image.", Name: "ImageSource", Type: "struct", Fields: []TypeFields{
276+
Description: "// ImageSource is the source of the underlying image.",
277+
Name: "ImageSource",
278+
Type: "struct",
279+
Fields: []TypeFields{
277280
{
278281
Description: "// Type is the type definition for a Type.", Name: "Type", Type: "ImageSourceType", SerializationInfo: "`json:\"type,omitempty\" yaml:\"type,omitempty\"`",
279282
},
@@ -284,6 +287,12 @@ func Test_createOneOf(t *testing.T) {
284287
Description: "// Id is the type definition for a Id.", Name: "Id", Type: "string", SerializationInfo: "`json:\"id,omitempty\" yaml:\"id,omitempty\"`",
285288
},
286289
},
290+
DiscriminatorKey: "type",
291+
DiscriminatorType: "ImageSourceType",
292+
DiscriminatorMappings: []DiscriminatorMapping{
293+
{EnumConstant: "ImageSourceTypeUrl", ConcreteType: "ImageSourceUrl"},
294+
{EnumConstant: "ImageSourceTypeSnapshot", ConcreteType: "ImageSourceSnapshot"},
295+
},
287296
},
288297
},
289298
want1: []EnumTemplate{

0 commit comments

Comments
 (0)