Skip to content

Commit 3b30ce3

Browse files
committed
Revert "Fix compose schema"
This reverts commit 25fe179. Signed-off-by: Nicolas De Loof <[email protected]>
1 parent ba6d569 commit 3b30ce3

File tree

9 files changed

+282
-582
lines changed

9 files changed

+282
-582
lines changed

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,3 @@ check-license: build-validate-image
4646
setup: ## Setup the precommit hook
4747
@which pre-commit > /dev/null 2>&1 || (echo "pre-commit not installed see README." && false)
4848
@pre-commit install
49-
50-
.PHONY: validate
51-
validate: lint test check-license

consts/consts.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ const (
2727
const Extensions = "#extensions" // Using # prefix, we prevent risk to conflict with an actual yaml key
2828

2929
type ComposeFileKey struct{}
30-
type ComposeSchema struct{}

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ require (
1111
github.com/mitchellh/copystructure v1.2.0
1212
github.com/mitchellh/mapstructure v1.5.0
1313
github.com/opencontainers/go-digest v1.0.0
14-
github.com/santhosh-tekuri/jsonschema v1.2.4
1514
github.com/sirupsen/logrus v1.9.0
1615
github.com/stretchr/testify v1.8.4
16+
github.com/xeipuuv/gojsonschema v1.2.0
1717
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3
1818
golang.org/x/sync v0.3.0
1919
gopkg.in/yaml.v3 v3.0.1
@@ -24,5 +24,7 @@ require (
2424
github.com/davecgh/go-spew v1.1.1 // indirect
2525
github.com/mitchellh/reflectwalk v1.0.2 // indirect
2626
github.com/pmezard/go-difflib v1.0.0 // indirect
27+
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
28+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
2729
golang.org/x/sys v0.1.0 // indirect
2830
)

go.sum

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,19 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
2222
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
2323
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2424
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
25-
github.com/santhosh-tekuri/jsonschema v1.2.4 h1:hNhW8e7t+H1vgY+1QeEQpveR6D4+OwKPXCfD2aieJis=
26-
github.com/santhosh-tekuri/jsonschema v1.2.4/go.mod h1:TEAUOeZSmIxTTuHatJzrvARHiuO9LYd+cIxzgEHCQI4=
2725
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
2826
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
2927
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
28+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
3029
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
3130
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
3231
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
32+
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
33+
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
34+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
35+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
36+
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
37+
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
3338
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
3439
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
3540
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=

loader/loader.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.
309309
// LoadWithContext reads a ConfigDetails and returns a fully loaded configuration as a compose-go Project
310310
func LoadWithContext(ctx context.Context, configDetails types.ConfigDetails, options ...func(*Options)) (*types.Project, error) {
311311
opts := toOptions(&configDetails, options)
312-
313312
dict, err := loadModelWithContext(ctx, &configDetails, opts)
314313
if err != nil {
315314
return nil, err
@@ -359,11 +358,6 @@ func loadYamlModel(ctx context.Context, config types.ConfigDetails, opts *Option
359358
dict = map[string]interface{}{}
360359
err error
361360
)
362-
sch, err := schema.CreateComposeSchema()
363-
if err != nil {
364-
return nil, fmt.Errorf("could not initialise schema: %w", err)
365-
}
366-
367361
for _, file := range config.ConfigFiles {
368362
fctx := context.WithValue(ctx, consts.ComposeFileKey{}, file.Filename)
369363
if file.Content == nil && file.Config == nil {
@@ -425,7 +419,7 @@ func loadYamlModel(ctx context.Context, config types.ConfigDetails, opts *Option
425419
}
426420

427421
if !opts.SkipValidation {
428-
if err := sch.Validate(dict); err != nil {
422+
if err := schema.Validate(dict); err != nil {
429423
return fmt.Errorf("validating %s: %w", file.Filename, err)
430424
}
431425
if _, ok := dict["version"]; ok {

0 commit comments

Comments
 (0)