ogen-go / ogen

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

code generation: a lot of issues with generating Go code for https://demo.thingsboard.io/v3/api-docs?group=thingsboard #1116

Open ardrabczyk opened 1 year ago

ardrabczyk commented 1 year ago

What version of ogen are you using?

$ go list -m github.com/ogen-go/ogen
github.com/ogen-go/ogen

I compiled it from tip of today's main:

$ git describe --always
78b0432b

Can this issue be reproduced with the latest version?

Yes

What did you do?

$ ./ogen 'https://demo.thingsboard.io/v3/api-docs?group=thingsboard'

Schema: https://demo.thingsboard.io/swagger-ui/#/

What did you expect to see?

Generated Go code.

What did you see instead?

First I get:

$ ./ogen 'https://demo.thingsboard.io/v3/api-docs?group=thingsboard'
  - api-docs:1:1418220 -> invalid name: "PageData«EntityVersion»" doesn't match "^[a-zA-Z0-9.\\-_]+$"

After commenting

if err := validateComponentsKeys(p, c); err != nil {
        return nil, err
}

I get:

- api-docs:1:1085604 -> parse path "/api/2fa/account/config/generate{?providerType}": path MUST NOT contain a query string

After commenting

case u.RawQuery != "":
        return nil, errors.New("path MUST NOT contain a query string")

I get:

- api-docs:1:1086888 -> parameter "?providerType" not specified

Is there something wrong with this spec https://demo.thingsboard.io/swagger-ui/#/?

ardrabczyk commented 1 year ago

This schema was generated by https://github.com/springfox/springfox which uses the « character https://github.com/search?q=repo%3Aspringfox%2Fspringfox%20%C2%AB&type=code

tdakkota commented 12 months ago

/api/2fa/account/config/generate{?providerType} is definitely wrong path template, query paramters should be described in the parameters section.

asv commented 12 months ago

@ardrabczyk Try validating your specification using https://github.com/daveshanley/vacuum before calling ogen.