Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor s/schema to use simpler types and improve TypeScript schema generation #89

Merged
merged 14 commits into from
Dec 12, 2023
Merged
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
16 changes: 8 additions & 8 deletions example/ast/ast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ func TestAstJsonConversionOnSimpleType(t *testing.T) {
jsonData, err := ValueToJSON(in)
assert.NoError(t, err)
assert.JSONEq(t, `{
"$type": "github.com/widmogrod/mkunion/example/ast.Lit",
"github.com/widmogrod/mkunion/example/ast.Lit": {
"$type": "ast.Lit",
"ast.Lit": {
"Value": 12
}
}`, string(jsonData))
Expand All @@ -26,19 +26,19 @@ func TestAstToJSONOnSumTypes(t *testing.T) {
assert.NoError(t, err)
t.Log(string(jsonData))
assert.JSONEq(t, `{
"$type": "github.com/widmogrod/mkunion/example/ast.Eq",
"github.com/widmogrod/mkunion/example/ast.Eq": {
"$type": "ast.Eq",
"ast.Eq": {
"L": {
"$type": "github.com/widmogrod/mkunion/example/ast.Accessor",
"github.com/widmogrod/mkunion/example/ast.Accessor": {
"$type": "ast.Accessor",
"ast.Accessor": {
"Path": [
"foo"
]
}
},
"R": {
"$type": "github.com/widmogrod/mkunion/example/ast.Lit",
"github.com/widmogrod/mkunion/example/ast.Lit": {
"$type": "ast.Lit",
"ast.Lit": {
"Value": "baz"
}
}
Expand Down
4 changes: 3 additions & 1 deletion example/my-app/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/labstack/echo/v4 v4.11.2
github.com/sashabaranov/go-openai v1.17.5
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
github.com/widmogrod/mkunion v1.19.0
golang.org/x/image v0.13.0
)
Expand All @@ -25,6 +26,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/sqs v1.24.5 // indirect
github.com/aws/smithy-go v1.14.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/structtag v1.2.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/labstack/gommon v0.4.0 // indirect
Expand All @@ -33,11 +35,11 @@ require (
github.com/opensearch-project/opensearch-go/v2 v2.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
Expand Down
Loading