Skip to content

Commit

Permalink
Update uuid type
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Jul 8, 2024
1 parent 2d7ba3a commit 9949df4
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 95 deletions.
10 changes: 9 additions & 1 deletion typespec/common.tsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
using TypeSpec.OpenAPI;
using TypeSpec.Http;

@format("UUIDv4, e.g.: \"e3bae040-7682-4457-aef8-20a419aed0bd\".")
@format("uuid")
@extension("x-go-type", "uuid.UUID")
@extension(
"x-go-type-import",
{
path: "github.com/google/uuid",
}
)
scalar uuid extends string;

@doc("POSIX-compatible exit code: 0 for success and any number from 1 to 255 for anything else.")
Expand Down
2 changes: 1 addition & 1 deletion typespec/main.tsp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import "@typespec/http";
import "@typespec/rest";
import "@typespec/openapi";
import "@typespec/openapi3";
import "@typespec/versioning";

import "./common.tsp";

using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@service({
Expand Down
165 changes: 73 additions & 92 deletions typespec/package-lock.json

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

5 changes: 4 additions & 1 deletion typespec/tsp-output/@typespec/openapi3/openapi.v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,10 @@ components:
description: 'E.g.: "2020-01-17T00:44:37".'
uuid:
type: string
format: 'UUIDv4, e.g.: "e3bae040-7682-4457-aef8-20a419aed0bd".'
format: uuid
x-go-type-import:
path: github.com/google/uuid
x-go-type: uuid.UUID
securitySchemes:
ApiKeyAuth:
type: apiKey
Expand Down

0 comments on commit 9949df4

Please sign in to comment.