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

Full JsonException type name in DateFormatConverter #1505

Merged
merged 1 commit into from May 15, 2022

Conversation

ProductiveRage
Copy link
Contributor

@ProductiveRage ProductiveRage commented Mar 15, 2022

When I was using this to generate C# definitions for the Transifex v3 API (using the JSON from their Download OpenAPI specification link, the generated code was not building because the type JsonException could not be found in the case that it appears within the DateFormatConverter (when SystemTextJson is used).

I changed it to use the full type name (System.Text.Json.JsonException), as seems to be the common use pattern elsewhere, and that seems to have fixed it.

In case it's useful, the settings that I was using were:

var settings = new CSharpClientGeneratorSettings
{
    ClassName = "Transifex{controller}Client",
    CSharpGeneratorSettings =
    {
        Namespace = "TransifexV3.ApiClient",
        GenerateJsonMethods = true,
        GenerateNullableReferenceTypes = true,
        GenerateNativeRecords = true,
        GenerateOptionalPropertiesAsNullable = true,
        ClassStyle = CSharpClassStyle.Record,
        JsonLibrary = CSharpJsonLibrary.SystemTextJson
    },
    GenerateClientInterfaces = true,
    OperationNameGenerator = new MultipleClientsFromPathSegmentsOperationNameGenerator()
};

(Note: There is still an error generating code for the Transifex API when the content type application/vnd.api+json;profile="bulk" is specified because the quotes don't get escaped - but I've raised that as a separate issue)

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

Successfully merging this pull request may close these issues.

None yet

2 participants