Fractaliste
Fractaliste

Reputation: 5957

How to import a type incuding its package name

I'm using last version of openapi-generator-maven-plugin (6.0.1)

In order to handle some binary data properly I need to use typeMappings configuration as described here : https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/README.md

So I configure my pom as following :

<configuration>
    <typeMappings>
        <typeMapping>string+binary=org.springframework.core.io.Resource</typeMapping>
    </typeMappings>
</configuration>

But the code-generator understand it as a OrgSpringframeworkCoreIoResource class. How can I tell it not to camel case my parameter?

Upvotes: 2

Views: 4863

Answers (1)

Fractaliste
Fractaliste

Reputation: 5957

I finally undertand the problem : it's a 2 step configuration.

<!-- First we map the OpenAPI type to a keyword -->
<typeMappings>
    <typeMapping>string+binary=Resource</typeMapping>
</typeMappings>

<!-- Then we attach the keyword to an existing type -->
<importMappings>Resource=org.springframework.core.io.Resource</importMappings>

That's way it works!

Upvotes: 7

Related Questions