ogen-go / ogen

OpenAPI v3 code generator for go
https://ogen.dev
Apache License 2.0
1.34k stars 76 forks source link

jschemagen: cannot unmarshal !!seq #976

Open ernado opened 1 year ago

ernado commented 1 year ago

https://github.com/open-telemetry/build-tools/blob/v0.18.0/semantic-conventions/semconv.schema.json

//go:generate go run github.com/ogen-go/ogen/cmd/jschemagen --package semconv --target semconv semconv.schema.json
parse:
    main.run
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/cmd/jschemagen/main.go:115
  - property "groups":
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:476
  - items:
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:216
  - anyOf:
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:216
  - allOf:
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:216
  - $ref:
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:216
  - resolve "#/definitions/SemanticConvention":
    github.com/ogen-go/ogen/jsonschema.(*Parser).resolve.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/resolve.go:61
  - allOf:
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:216
  - $ref:
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:216
  - resolve "#/definitions/SemanticConventionBase":
    github.com/ogen-go/ogen/jsonschema.(*Parser).resolve.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/resolve.go:61
  - property "attributes":
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:476
  - items:
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:216
  - $ref:
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:216
  - resolve "#/definitions/Attribute":
    github.com/ogen-go/ogen/jsonschema.(*Parser).resolve.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/resolve.go:61
  - allOf:
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:216
  - property "examples":
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:476
  - anyOf:
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:216
  - at 400:19:
  - $ref:
    github.com/ogen-go/ogen/jsonschema.(*Parser).parseSchema.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/parser.go:216
  - resolve "#/definitions/ValueType":
    github.com/ogen-go/ogen/jsonschema.(*Parser).resolve.func1
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/resolve.go:61
  - decode:
    github.com/ogen-go/ogen/jsonschema.(*RootResolver).ResolveReference
        /go/pkg/mod/github.com/ogen-go/ogen@v0.70.1/jsonschema/resolver.go:33
  - yaml: unmarshal errors:
  yaml: line 320: cannot unmarshal !!seq into string; yaml: line 329: cannot unmarshal !!seq into string
exit status 1
api.go:6: running "go": exit status 1
tdakkota commented 1 year ago

The problem is https://github.com/open-telemetry/build-tools/blob/2e9bfeebd327d14a5c5c3daece9b48f756b78cb7/semantic-conventions/semconv.schema.json#L320-L324

ogen do not support array type definition for now.

I wonder why error is not rendered properly.

ernado commented 1 year ago

I think it is time to support the type array.

mattoni commented 11 months ago

I agree, OpenAPI 3.1 has been out for awhile now, and a type array is the defacto way to handle nullable values. Can this be bumped up in priority?

mattoni commented 6 months ago

Any chance this can be bumped up now that ogen is at v1.0.0? I've updated all my specs to 3.1.0 and would like to avoid down-versioning if possible, and ogen is one of the last tools I need to be able to utilize an updated spec.