Search code examples
c++openapi-generator-cli

Pistache openapi generator not mapping schema


I'm using the pistache server generator to generate a model. I have a schemaMapping such as :

MyObject1: org::openapi::model::MyObject2

When the generator runs MyObject1 is NOT created as expected. However, the endpoint still uses it. It includes MyObject1.h and all the arguments are still MyObject1.

I expected the endpoint to use MyObject2?

Is that a bug? Is there a way to force usage of MyObject2 ?

Thanks.


Solution

  • I was able to get what I wanted by setting schemaMapping, typeMapping, and importMapping like this:

    schemaMappings:
      MyObject1: MyObj
    importMappings:
      MyObject1: MyObj
    typeMappings:
      MyObject1: MyObj
    

    The schemaMapping controls if the object will be created or not. The importMapping controls the include file, and the typeMapping controls the type of the arguments.