Generate client from CDF openapi spec for Go

  • 30 November 2023
  • 1 reply

I am unable to generate client code for the CDF openapi spec at using deepmap/oapi-codegen for Go, seemingly because the spec contains some errors. Do anyone know of a way to generate an api-client in go for the CDF-api spec?


Both commands below rely on having openapi spec downloaded to the current directory from


Testing the spec for errors with redocly/cli: docker run --rm -it -v $PWD/swagger.json:/swagger.json redocly/cli lint /swagger.json

For me this results in “Validation failed with 25 errors and 382 warnings”


Generating the client library using deepmap/oapi-codegen: go run --config oapi-codegen-config.yaml swagger.json

with the this config file:

package: "cdf_api"
output: "cdf_api.gen.go"
models: true
client: true
circular-reference-limit: 100

For me this results in the message “error generating code: error creating operation definitions: path '/documents/search' has 0 positional parameters, but spec has 1 declared” - I started fixing some errors, but there was quite a few of them, so I stopped.




Best answer by Dilini Fernando 17 June 2024, 14:08

View original

1 reply

Userlevel 4
Badge +2

Hi @andcondall,

Our product teams are working hard to make sure our APIs meet the OpenAPI spec, but every now and then we might run into some issues. If you come across any specific, critical non-conformities, we'd really appreciate it if you could log a ticket for us or send an email to . This will help us prioritize and address them properly among other items in our bug backlog.