jdegre/5GC_APIs

How to generate code?

mnm-analytics opened this issue ยท 6 comments

Hi @jdegre,
I'm trying to generate a code from yaml by openapi-generator.
But the code doesn't work as below.

  • python-flask
  • nodejs

What tool should I use for generating?

Hi @mnm-signate,
I'm afraid I cannot help you with that; I don't have experience with openapi-generator, and I don't really have a clue about why it might not work with a given YAML file.

I suppose you may have better luck asking, or raising an issue, in the openapi-generator repo itself.

By all means, if you detect any specific issue (e.g., a wrong OpenAPI construct, or any syntax errors) with the OpenAPI files in this 5GC repo, absolutely feel free to report it here so we can take action.

Hi again @mnm-signate,
Out of curiosity, I made some quick tests with openapi-generator, and I immediately saw that it gives an error while processing query parameters specified with the syntax:

  parameters:
    - name: param
      in: query
      content:
        application/json:
          schema:
            ...

Not sure if the API you were trying to work with has such construct in any of their HTTP operations, but this is just an example of a legal OpenAPI construct that apparently is not directly supported by this specific code generator (unless you need to specify additional options or configuration parameters, which I did not use; I used all "default" options for the code generator).

In my experience from one year ago, openapi-generator (the fork of Swagger generator) was pretty broken, and barely usable with languages other than Java and Go. Support of v3.0 features was still very incomplete.
Things should be better today but do not assume an easy trip.

After some more testing with openapi-generator, I found other legal OpenAPI constructs, used extensively in the 5GC APIs, which are currently not supported by their code generator. For example, see issue #2610, where it is shown how the generator fails in structures like this:

    ComplexData:
      type: object
      properties:
        username:
          type: string
        email:
          type: string
      allOf:
        - oneOf:
          - required: [ username ]
          - required: [ email ]

Thank you for teaching me so kindly.
I continue to try generating code. I'll report if I detect any specific issue.

I am not sure, but probably you should have a look at #9548 in swagger-sodegen