Skip to content

Commit

Permalink
Merge pull request #89 from widmogrod/feature/generics-or-alternative
Browse files Browse the repository at this point in the history
Refactor s/schema to use simpler types and improve TypeScript schema generation
  • Loading branch information
widmogrod authored Dec 12, 2023
2 parents 717b2a7 + f6e3779 commit 3580794
Show file tree
Hide file tree
Showing 51 changed files with 3,001 additions and 1,408 deletions.
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

0 comments on commit 3580794

Please sign in to comment.