2

As the krakend.json is not of the type which swagger understands.Following error occurs:

Error: Document must be valid OpenAPI 3.0.0 definition

Is there any alternate way to generate documentation for krakenD

salsinga
  • 1,957
  • 1
  • 14
  • 26

1 Answers1

2

Generating both KrakenD configuration and OpenAPI documentation is possible, but...

  • You should precisely define your use case:
    • Do you want to generate krakend.json config from OpenAPI just as no-op proxy? (see an example script)
    • Are you willing to adopt another (custom) format? (see openapi2krakend)
    • Do you want to generate OpenAPI documentation from KrakenD config? If so, do you need just a list of endpoints or do you want also to have defined descriptions, examples and types (!) in one file?
  • You should (at least try to) write the script to generate the configuration by yourself to suit your needs.
  • Consider a usage of KrakenD Studio that has the OpenAPI generator plugin.

It can look like a good idea, but the devil is in the details and you should analyse your requirements because these two files have totally different purposes. I can only suggest you write such a transformation script (as I did) which should be like "5 minutes of work" and then go to the deep.


Edit: We have selected a subset of KrakendD features and implemented our own configuration generator (from OAS). We use tags with a custom route-to/ prefix for metadata, a definition could look like this:

  /coupons/{id}:
    get:
      tags:
        - Coupons
        - route-to/path=/coupons/{id}/detail
        - route-to/backend=GET|http://coupons.content
        - route-to/flags=jwt_validation
Milan Jaros
  • 1,107
  • 17
  • 24