Skip to content

How to get the error object is Pascal Case #148

@RoLYroLLs

Description

@RoLYroLLs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions