diff --git a/dsl.go b/dsl.go index c1e2eabeb..84822d97c 100644 --- a/dsl.go +++ b/dsl.go @@ -956,6 +956,9 @@ func (s *Schema) ToNamed(n string) *NamedSchema { return NewNamedSchema(n, s) } +// Int returns an integer OAS data type (Schema). +func Int() *Schema { return schema("integer", "") } + // Int32 returns an 32-bit integer OAS data type (Schema). func Int32() *Schema { return schema("integer", "int32") } @@ -971,6 +974,9 @@ func Double() *Schema { return schema("number", "double") } // String returns a string OAS data type (Schema). func String() *Schema { return schema("string", "") } +// UUID returns a UUID OAS data type (Schema). +func UUID() *Schema { return schema("string", "uuid") } + // Bytes returns a base64 encoded OAS data type (Schema). func Bytes() *Schema { return schema("string", "byte") } diff --git a/dsl_test.go b/dsl_test.go index 4ccd4d889..c5ae189b2 100644 --- a/dsl_test.go +++ b/dsl_test.go @@ -42,6 +42,7 @@ var ( ogen.NewSchema(). SetDescription("A Pet"). AddRequiredProperties( + ogen.Int().ToProperty("required_Int"), ogen.Int32().ToProperty("required_Int32"), ogen.Int64().ToProperty("required_Int64"), ogen.Float().ToProperty("required_Float"), @@ -60,6 +61,7 @@ var ( ToProperty("required_enum_String"), ). AddOptionalProperties( + ogen.UUID().ToProperty("optional_UUID"), ogen.Int32().ToProperty("optional_Int32"), ogen.Int64().ToProperty("optional_Int64"), ogen.Float().ToProperty("optional_Float"),