Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [typescript-axios] setting withSeparateModelsAndApi=true breaks the application #16532

Open
2 tasks
LucijanKvar opened this issue Sep 7, 2023 · 2 comments

Comments

@LucijanKvar
Copy link

LucijanKvar commented Sep 7, 2023

Bug Report Checklist

  • [✅] Have you provided a full/minimal spec to reproduce the issue?
  • [✅] Have you validated the input using an OpenAPI validator (example)?
  • [✅] Have you tested with the latest master to confirm the issue still exists?
  • [✅] Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When generating client without 'withSeparateModelsAndApi' flag on, the generated client works with no problem. But when I set the withSeparateModelsAndApi to true and set the apiPackage and the modelPackage, application some how breaks. All I get is the error: 'SyntaxError: ambiguous indirect export: Address'.

This is how I use the API:

`
import { onMounted } from 'vue';
import { PetApi } from '@/api-axios/api/pet-api';
import { PetStatus } from '@/api-axios/models/';

const api = new PetApi();

const fetchPet = async () => {
try{
const response = await api.findPetsByStatus(PetStatus.Available);
console.log(response);
}
catch{

}
}

onMounted(() => {
fetchPet();
})
`

openapi-generator version

7.0.0

OpenAPI declaration file content or url

SwaggerPetstore.json

Generation Details

java -jar "@openapitools/openapi-generator-cli/versions/7.0.0.jar" generate --input-spec="./pets.json" --generator-name="typescript-axios" --output="src/api-axios" --additional-properties="enumNameSuffix=,withSeparateModelsAndApi=true,apiPackage=api,modelPackage=models"

@codeart1st
Copy link

We also have problems with typescript-axios since 7.0.0 and withSeparateModelsAndApi=true. The previous version 6.6.0 was fine for us.

We have problems with generated models and allOf+discriminator types. With version 6.6.0 a MoreSpecialTypeAllOf.ts file was generated and exported as export GenericTyp & MoreSpecialTypeAllOf. Seems that inheritance is completly broken.

@Mettbrot
Copy link

We also have problems with typescript-axios since 7.0.0 and withSeparateModelsAndApi=true. The previous version 6.6.0 was fine for us.

We have problems with generated models and allOf+discriminator types. With version 6.6.0 a MoreSpecialTypeAllOf.ts file was generated and exported as export GenericTyp & MoreSpecialTypeAllOf. Seems that inheritance is completly broken.

Same as #16150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants