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

TypeScriptGeneratorSettings.HandleReferences is broken in Axios template #4558

Open
PeterDraex opened this issue Oct 29, 2023 · 2 comments
Open

Comments

@PeterDraex
Copy link

TypeScript code generated with template Axios can not handle references. It does have definition of jsonParse function, which contains the reference-handling code, but this function is not called from anywhere.

Tested on version 14.0.0-preview008.

My code for running generation:

public async Task<string> Generate()
{
    var document = await OpenApiDocument.FromUrlAsync(swaggerSpecUrl);

    var settings = new TypeScriptClientGeneratorSettings
    {
        Template = TypeScriptTemplate.Axios,

    };

    settings.TypeScriptGeneratorSettings.PropertyNameGenerator = new CustomPropertyNameGenerator();
    settings.TypeScriptGeneratorSettings.TypeScriptVersion = 5.2M;
    settings.TypeScriptGeneratorSettings.MarkOptionalProperties = false;
    settings.TypeScriptGeneratorSettings.HandleReferences = true;

    var generator = new TypeScriptClientGenerator(document, settings);
    var code = generator.GenerateFile();

    return code;
}
@RicoSuter
Copy link
Owner

Did this work in v13?

@PeterDraex
Copy link
Author

PeterDraex commented Nov 6, 2023

Did this work in v13?

No

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

No branches or pull requests

2 participants