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

Custom Exception types are generating all base types net80 #1661

Open
mdawood1991 opened this issue Jan 10, 2024 · 1 comment
Open

Custom Exception types are generating all base types net80 #1661

mdawood1991 opened this issue Jan 10, 2024 · 1 comment

Comments

@mdawood1991
Copy link

I have a IOperationProcessor which adds different types of exceptions to the schema, but since updating to netcore80 it is generating all base class properties in the result swagger.json file.

As per the documentation JsonSchemaGenerator

System.Exception
Only the properties "InnerException", "Message", "Source", "StackTrace" are generated.

My Exception classes are very simple e.g.

public class ForbiddenAccessException : Exception
{
    public ForbiddenAccessException() : base() { }
}

This is the implementation of the CustomExceptionsGenerator

Note: I have also tried using the Attributes - same result

`[ProducesResponseType(typeof(ForbiddenAccessException), 403)]`
public class CustomExceptionsGenerator : IOperationProcessor
{
    public bool Process(OperationProcessorContext context)
    {
        AddResponse<ValidationException>(context, StatusCodes.Status400BadRequest);
        AddResponse<UnauthorizedAccessException>(context, StatusCodes.Status401Unauthorized);
        AddResponse<NotFoundException>(context, StatusCodes.Status404NotFound);
        AddResponse<ForbiddenAccessException>(context, StatusCodes.Status403Forbidden);

        return true;
    }

    private static void AddResponse<T>(OperationProcessorContext context, int statusCode) where T : Exception
    {
        var responseType = typeof(T);
        var responseTypeName = responseType.Name;

        if (!context.SchemaResolver.HasSchema(responseType, false))
        {
            var schema = context.SchemaGenerator.Generate(responseType);
            context.SchemaResolver.AddSchema(responseType, false, schema);

            context.OperationDescription.Operation.Responses.Add(
                statusCode.ToString(),
                new OpenApiResponse { Description = $"Error: {responseTypeName}", Schema = new JsonSchema { Reference = schema } }
            );
        }
        else
        {
            var schema = context.SchemaResolver.GetSchema(responseType, false);
            context.OperationDescription.Operation.Responses.Add(
                statusCode.ToString(),
                new OpenApiResponse { Description = $"Error: {responseTypeName}", Schema = new JsonSchema { Reference = schema } }
            );
        }
    }
}

AddOpenApiDocument configuration is

        services.AddOpenApiDocument((configure, sp) =>
        {
            configure.Title = "API";
            configure.AddSecurity("JWT", Enumerable.Empty<string>(), new OpenApiSecurityScheme
            {
                Type = OpenApiSecuritySchemeType.ApiKey,
                Name = "Authorization",
                In = OpenApiSecurityApiKeyLocation.Header,
                Description = "Type into the textbox: Bearer {your JWT token}."
            });

            configure.OperationProcessors.Add(new AspNetCoreOperationSecurityScopeProcessor("JWT"));
            configure.OperationProcessors.Add(new CustomExceptionsGenerator());
        });

This is an extract from the result specification json

        "responses": {
          "200": { .... 
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForbiddenAccessException"
                }
              }
            }
          }
        }

and the schema for the ForbiddenAccessException is:

      "ForbiddenAccessException": {
        "title": "ForbiddenAccessException",
        "definitions": {
          "Exception": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "targetSite": {
                "nullable": true,
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodBase"
                  }
                ]
              },
              "hasBeenThrown": {
                "type": "boolean"
              },
              "serializationWatsonBuckets": {
                "nullable": true
              },
              "message": {
                "type": "string"
              },
              "data": {
                "type": "array",
                "items": {}
              },
              "innerException": {
                "nullable": true,
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/Exception"
                  }
                ]
              },
              "helpLink": {
                "type": "string",
                "nullable": true
              },
              "source": {
                "type": "string",
                "nullable": true
              },
              "hResult": {
                "type": "integer",
                "format": "int32"
              },
              "stackTrace": {
                "type": "string",
                "nullable": true
              },
              "serializationStackTraceString": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "MethodBase": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberInfo"
              },
              {
                "type": "object",
                "x-abstract": true,
                "additionalProperties": false,
                "properties": {
                  "attributes": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodAttributes"
                  },
                  "methodImplementationFlags": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodImplAttributes"
                  },
                  "callingConvention": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/CallingConventions"
                  },
                  "isAbstract": {
                    "type": "boolean"
                  },
                  "isConstructor": {
                    "type": "boolean"
                  },
                  "isFinal": {
                    "type": "boolean"
                  },
                  "isHideBySig": {
                    "type": "boolean"
                  },
                  "isSpecialName": {
                    "type": "boolean"
                  },
                  "isStatic": {
                    "type": "boolean"
                  },
                  "isVirtual": {
                    "type": "boolean"
                  },
                  "isAssembly": {
                    "type": "boolean"
                  },
                  "isFamily": {
                    "type": "boolean"
                  },
                  "isFamilyAndAssembly": {
                    "type": "boolean"
                  },
                  "isFamilyOrAssembly": {
                    "type": "boolean"
                  },
                  "isPrivate": {
                    "type": "boolean"
                  },
                  "isPublic": {
                    "type": "boolean"
                  },
                  "isConstructedGenericMethod": {
                    "type": "boolean"
                  },
                  "isGenericMethod": {
                    "type": "boolean"
                  },
                  "isGenericMethodDefinition": {
                    "type": "boolean"
                  },
                  "containsGenericParameters": {
                    "type": "boolean"
                  },
                  "methodHandle": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/RuntimeMethodHandle"
                  },
                  "isSecurityCritical": {
                    "type": "boolean"
                  },
                  "isSecuritySafeCritical": {
                    "type": "boolean"
                  },
                  "isSecurityTransparent": {
                    "type": "boolean"
                  }
                }
              }
            ]
          },
          "MethodAttributes": {
            "type": "integer",
            "description": "",
            "x-enumFlags": true,
            "x-enumNames": [
              "PrivateScope",
              "ReuseSlot",
              "Private",
              "FamANDAssem",
              "Assembly",
              "Family",
              "FamORAssem",
              "Public",
              "MemberAccessMask",
              "UnmanagedExport",
              "Static",
              "Final",
              "Virtual",
              "HideBySig",
              "NewSlot",
              "VtableLayoutMask",
              "CheckAccessOnOverride",
              "Abstract",
              "SpecialName",
              "RTSpecialName",
              "PinvokeImpl",
              "HasSecurity",
              "RequireSecObject",
              "ReservedMask"
            ],
            "enum": [
              0,
              0,
              1,
              2,
              3,
              4,
              5,
              6,
              7,
              8,
              16,
              32,
              64,
              128,
              256,
              256,
              512,
              1024,
              2048,
              4096,
              8192,
              16384,
              32768,
              53248
            ]
          },
          "MethodImplAttributes": {
            "type": "integer",
            "description": "",
            "x-enumNames": [
              "IL",
              "Managed",
              "Native",
              "OPTIL",
              "CodeTypeMask",
              "Runtime",
              "ManagedMask",
              "Unmanaged",
              "NoInlining",
              "ForwardRef",
              "Synchronized",
              "NoOptimization",
              "PreserveSig",
              "AggressiveInlining",
              "AggressiveOptimization",
              "InternalCall",
              "MaxMethodImplVal"
            ],
            "enum": [
              0,
              0,
              1,
              2,
              3,
              3,
              4,
              4,
              8,
              16,
              32,
              64,
              128,
              256,
              512,
              4096,
              65535
            ]
          },
          "CallingConventions": {
            "type": "integer",
            "description": "",
            "x-enumFlags": true,
            "x-enumNames": [
              "Standard",
              "VarArgs",
              "Any",
              "HasThis",
              "ExplicitThis"
            ],
            "enum": [
              1,
              2,
              3,
              32,
              64
            ]
          },
          "RuntimeMethodHandle": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "value": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              }
            }
          },
          "IntPtr": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "size": {
                "type": "integer",
                "format": "int32"
              },
              "maxValue": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              },
              "minValue": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              },
              "system.Numerics.IAdditiveIdentity<nint,nint>.AdditiveIdentity": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              },
              "system.Numerics.IBinaryNumber<nint>.AllBitsSet": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              },
              "system.Numerics.IMinMaxValue<nint>.MinValue": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              },
              "system.Numerics.IMinMaxValue<nint>.MaxValue": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              },
              "system.Numerics.IMultiplicativeIdentity<nint,nint>.MultiplicativeIdentity": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              },
              "system.Numerics.INumberBase<nint>.One": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              },
              "system.Numerics.INumberBase<nint>.Radix": {
                "type": "integer",
                "format": "int32"
              },
              "system.Numerics.INumberBase<nint>.Zero": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              },
              "system.Numerics.ISignedNumber<nint>.NegativeOne": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              }
            }
          },
          "MemberInfo": {
            "type": "object",
            "x-abstract": true,
            "additionalProperties": false,
            "properties": {
              "memberType": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberTypes"
              },
              "name": {
                "type": "string"
              },
              "declaringType": {
                "type": "string",
                "nullable": true
              },
              "reflectedType": {
                "type": "string",
                "nullable": true
              },
              "module": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/Module"
              },
              "customAttributes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ForbiddenAccessException/definitions/CustomAttributeData"
                }
              },
              "isCollectible": {
                "type": "boolean"
              },
              "metadataToken": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          "MemberTypes": {
            "type": "integer",
            "description": "",
            "x-enumFlags": true,
            "x-enumNames": [
              "Constructor",
              "Event",
              "Field",
              "Method",
              "Property",
              "TypeInfo",
              "Custom",
              "NestedType",
              "All"
            ],
            "enum": [
              1,
              2,
              4,
              8,
              16,
              32,
              64,
              128,
              191
            ]
          },
          "Module": {
            "type": "object",
            "x-abstract": true,
            "additionalProperties": false,
            "properties": {
              "assembly": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/Assembly"
              },
              "fullyQualifiedName": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "mdStreamVersion": {
                "type": "integer",
                "format": "int32"
              },
              "moduleVersionId": {
                "type": "string",
                "format": "guid"
              },
              "scopeName": {
                "type": "string"
              },
              "moduleHandle": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/ModuleHandle"
              },
              "customAttributes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ForbiddenAccessException/definitions/CustomAttributeData"
                }
              },
              "metadataToken": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          "Assembly": {
            "type": "object",
            "x-abstract": true,
            "additionalProperties": false,
            "properties": {
              "definedTypes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ForbiddenAccessException/definitions/TypeInfo"
                }
              },
              "exportedTypes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "codeBase": {
                "type": "string",
                "deprecated": true,
                "x-deprecatedMessage": "Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location.",
                "nullable": true
              },
              "entryPoint": {
                "nullable": true,
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodInfo"
                  }
                ]
              },
              "fullName": {
                "type": "string",
                "nullable": true
              },
              "imageRuntimeVersion": {
                "type": "string"
              },
              "isDynamic": {
                "type": "boolean"
              },
              "location": {
                "type": "string"
              },
              "reflectionOnly": {
                "type": "boolean"
              },
              "isCollectible": {
                "type": "boolean"
              },
              "isFullyTrusted": {
                "type": "boolean"
              },
              "customAttributes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ForbiddenAccessException/definitions/CustomAttributeData"
                }
              },
              "escapedCodeBase": {
                "type": "string",
                "deprecated": true,
                "x-deprecatedMessage": "Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location."
              },
              "manifestModule": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/Module"
              },
              "modules": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ForbiddenAccessException/definitions/Module"
                }
              },
              "globalAssemblyCache": {
                "type": "boolean",
                "deprecated": true,
                "x-deprecatedMessage": "The Global Assembly Cache is not supported."
              },
              "hostContext": {
                "type": "integer",
                "format": "int64"
              },
              "securityRuleSet": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/SecurityRuleSet"
              }
            }
          },
          "TypeInfo": {
            "allOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "x-abstract": true,
                "additionalProperties": false,
                "properties": {
                  "genericTypeParameters": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "declaredConstructors": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ForbiddenAccessException/definitions/ConstructorInfo"
                    }
                  },
                  "declaredEvents": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ForbiddenAccessException/definitions/EventInfo"
                    }
                  },
                  "declaredFields": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ForbiddenAccessException/definitions/FieldInfo"
                    }
                  },
                  "declaredMembers": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberInfo"
                    }
                  },
                  "declaredMethods": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodInfo"
                    }
                  },
                  "declaredNestedTypes": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ForbiddenAccessException/definitions/TypeInfo"
                    }
                  },
                  "declaredProperties": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ForbiddenAccessException/definitions/PropertyInfo"
                    }
                  },
                  "implementedInterfaces": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            ]
          },
          "ConstructorInfo": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodBase"
              },
              {
                "type": "object",
                "x-abstract": true,
                "additionalProperties": false,
                "properties": {
                  "memberType": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberTypes"
                  }
                }
              }
            ]
          },
          "EventInfo": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberInfo"
              },
              {
                "type": "object",
                "x-abstract": true,
                "additionalProperties": false,
                "properties": {
                  "memberType": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberTypes"
                  },
                  "attributes": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/EventAttributes"
                  },
                  "isSpecialName": {
                    "type": "boolean"
                  },
                  "addMethod": {
                    "nullable": true,
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodInfo"
                      }
                    ]
                  },
                  "removeMethod": {
                    "nullable": true,
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodInfo"
                      }
                    ]
                  },
                  "raiseMethod": {
                    "nullable": true,
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodInfo"
                      }
                    ]
                  },
                  "isMulticast": {
                    "type": "boolean"
                  },
                  "eventHandlerType": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            ]
          },
          "EventAttributes": {
            "type": "integer",
            "description": "",
            "x-enumFlags": true,
            "x-enumNames": [
              "None",
              "SpecialName",
              "RTSpecialName",
              "ReservedMask"
            ],
            "enum": [
              0,
              512,
              1024,
              1024
            ]
          },
          "MethodInfo": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodBase"
              },
              {
                "type": "object",
                "x-abstract": true,
                "additionalProperties": false,
                "properties": {
                  "memberType": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberTypes"
                  },
                  "returnParameter": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/ParameterInfo"
                  },
                  "returnType": {
                    "type": "string"
                  },
                  "returnTypeCustomAttributes": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/ICustomAttributeProvider"
                  },
                  "genericParameterCount": {
                    "type": "integer",
                    "format": "int32"
                  }
                }
              }
            ]
          },
          "ParameterInfo": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "attributes": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/ParameterAttributes"
              },
              "member": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberInfo"
              },
              "name": {
                "type": "string",
                "nullable": true
              },
              "parameterType": {
                "type": "string"
              },
              "position": {
                "type": "integer",
                "format": "int32"
              },
              "isIn": {
                "type": "boolean"
              },
              "isLcid": {
                "type": "boolean"
              },
              "isOptional": {
                "type": "boolean"
              },
              "isOut": {
                "type": "boolean"
              },
              "isRetval": {
                "type": "boolean"
              },
              "defaultValue": {
                "nullable": true
              },
              "rawDefaultValue": {
                "nullable": true
              },
              "hasDefaultValue": {
                "type": "boolean"
              },
              "customAttributes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ForbiddenAccessException/definitions/CustomAttributeData"
                }
              },
              "metadataToken": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          "ParameterAttributes": {
            "type": "integer",
            "description": "",
            "x-enumFlags": true,
            "x-enumNames": [
              "None",
              "In",
              "Out",
              "Lcid",
              "Retval",
              "Optional",
              "HasDefault",
              "HasFieldMarshal",
              "Reserved3",
              "Reserved4",
              "ReservedMask"
            ],
            "enum": [
              0,
              1,
              2,
              4,
              8,
              16,
              4096,
              8192,
              16384,
              32768,
              61440
            ]
          },
          "CustomAttributeData": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "attributeType": {
                "type": "string"
              },
              "constructor": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/ConstructorInfo"
              },
              "constructorArguments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ForbiddenAccessException/definitions/CustomAttributeTypedArgument"
                }
              },
              "namedArguments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ForbiddenAccessException/definitions/CustomAttributeNamedArgument"
                }
              }
            }
          },
          "CustomAttributeTypedArgument": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "argumentType": {
                "type": "string"
              },
              "value": {
                "nullable": true
              }
            }
          },
          "CustomAttributeNamedArgument": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "argumentType": {
                "type": "string"
              },
              "memberInfo": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberInfo"
              },
              "typedValue": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/CustomAttributeTypedArgument"
              },
              "memberName": {
                "type": "string"
              },
              "isField": {
                "type": "boolean"
              }
            }
          },
          "ICustomAttributeProvider": {
            "type": "object",
            "x-abstract": true,
            "additionalProperties": false
          },
          "FieldInfo": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberInfo"
              },
              {
                "type": "object",
                "x-abstract": true,
                "additionalProperties": false,
                "properties": {
                  "memberType": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberTypes"
                  },
                  "attributes": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/FieldAttributes"
                  },
                  "fieldType": {
                    "type": "string"
                  },
                  "isInitOnly": {
                    "type": "boolean"
                  },
                  "isLiteral": {
                    "type": "boolean"
                  },
                  "isNotSerialized": {
                    "type": "boolean",
                    "deprecated": true,
                    "x-deprecatedMessage": "Formatter-based serialization is obsolete and should not be used."
                  },
                  "isPinvokeImpl": {
                    "type": "boolean"
                  },
                  "isSpecialName": {
                    "type": "boolean"
                  },
                  "isStatic": {
                    "type": "boolean"
                  },
                  "isAssembly": {
                    "type": "boolean"
                  },
                  "isFamily": {
                    "type": "boolean"
                  },
                  "isFamilyAndAssembly": {
                    "type": "boolean"
                  },
                  "isFamilyOrAssembly": {
                    "type": "boolean"
                  },
                  "isPrivate": {
                    "type": "boolean"
                  },
                  "isPublic": {
                    "type": "boolean"
                  },
                  "isSecurityCritical": {
                    "type": "boolean"
                  },
                  "isSecuritySafeCritical": {
                    "type": "boolean"
                  },
                  "isSecurityTransparent": {
                    "type": "boolean"
                  },
                  "fieldHandle": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/RuntimeFieldHandle"
                  }
                }
              }
            ]
          },
          "FieldAttributes": {
            "type": "integer",
            "description": "",
            "x-enumFlags": true,
            "x-enumNames": [
              "PrivateScope",
              "Private",
              "FamANDAssem",
              "Assembly",
              "Family",
              "FamORAssem",
              "Public",
              "FieldAccessMask",
              "Static",
              "InitOnly",
              "Literal",
              "NotSerialized",
              "HasFieldRVA",
              "SpecialName",
              "RTSpecialName",
              "HasFieldMarshal",
              "PinvokeImpl",
              "HasDefault",
              "ReservedMask"
            ],
            "enum": [
              0,
              1,
              2,
              3,
              4,
              5,
              6,
              7,
              16,
              32,
              64,
              128,
              256,
              512,
              1024,
              4096,
              8192,
              32768,
              38144
            ]
          },
          "RuntimeFieldHandle": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "value": {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/IntPtr"
              }
            }
          },
          "PropertyInfo": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberInfo"
              },
              {
                "type": "object",
                "x-abstract": true,
                "additionalProperties": false,
                "properties": {
                  "memberType": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MemberTypes"
                  },
                  "propertyType": {
                    "type": "string"
                  },
                  "attributes": {
                    "$ref": "#/components/schemas/ForbiddenAccessException/definitions/PropertyAttributes"
                  },
                  "isSpecialName": {
                    "type": "boolean"
                  },
                  "canRead": {
                    "type": "boolean"
                  },
                  "canWrite": {
                    "type": "boolean"
                  },
                  "getMethod": {
                    "nullable": true,
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodInfo"
                      }
                    ]
                  },
                  "setMethod": {
                    "nullable": true,
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/ForbiddenAccessException/definitions/MethodInfo"
                      }
                    ]
                  }
                }
              }
            ]
          },
          "PropertyAttributes": {
            "type": "integer",
            "description": "",
            "x-enumFlags": true,
            "x-enumNames": [
              "None",
              "SpecialName",
              "RTSpecialName",
              "HasDefault",
              "Reserved2",
              "Reserved3",
              "Reserved4",
              "ReservedMask"
            ],
            "enum": [
              0,
              512,
              1024,
              4096,
              8192,
              16384,
              32768,
              62464
            ]
          },
          "SecurityRuleSet": {
            "type": "integer",
            "description": "",
            "x-enumNames": [
              "None",
              "Level1",
              "Level2"
            ],
            "enum": [
              0,
              1,
              2
            ]
          },
          "ModuleHandle": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "mdStreamVersion": {
                "type": "integer",
                "format": "int32"
              }
            }
          }
        },
        "allOf": [
          {
            "$ref": "#/components/schemas/ForbiddenAccessException/definitions/Exception"
          },
          {
            "type": "object",
            "additionalProperties": false
          }
        ]
      }
@mdawood1991
Copy link
Author

Forgot to add the Package Version:

    <PackageReference Include="NSwag.AspNetCore" Version="14.0.0" />
    <PackageReference Include="NSwag.MSBuild" Version="14.0.0">
        <PrivateAssets>all</PrivateAssets>
        <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>

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