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

How to get the error object is Pascal Case #148

Open
RoLYroLLs opened this issue Jul 11, 2024 · 0 comments
Open

How to get the error object is Pascal Case #148

RoLYroLLs opened this issue Jul 11, 2024 · 0 comments

Comments

@RoLYroLLs
Copy link

RoLYroLLs commented Jul 11, 2024

I've been searching up and down the web, but maybe I'm not searching right so I've finally decided to ask here.

Is there a way to return the built-in error object in Pascal Case vs Camel Case?

It's probably bad practice on our part to use PascalCase for JSON, but we are ok with it for this particular project. Here's a test result we were testing. You'll notice only the properties within the ExceptionMessage object is in CamelCase.

{
    "Version": "2.0",
    "StatusCode": 415,
    "Message": null,
    "IsError": true,
    "ResponseException": {
        "ExceptionMessage": {
            "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
            "title": "Unsupported Media Type",
            "status": 415,
            "traceId": "00-0d2fa91cddff04de600846d8e2d19746-7c76888436fbd052-00"
        },
        "Details": null,
        "ReferenceErrorCode": null,
        "ReferenceDocumentLink": null,
        "ValidationErrors": null
    },
    "Result": null
}

Here is our initializer

builder.UseApiResponseAndExceptionWrapper(new AutoWrapperOptions {
	UseCustomSchema = false,
	ShowStatusCode = true,
	ShowApiVersion = true,
	IgnoreNullValue = false,
	UseCamelCaseNamingStrategy = false,
	EnableExceptionLogging = false,
	EnableResponseLogging = false,
	LogRequestDataOnException = false,
});

Thanks in advance.

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

1 participant