Skip to content

System.MissingMethodException when using NSwag #159

@ladamikAzets

Description

@ladamikAzets

Hi, when swagger documentation is generated I get warnings:
{"EventId":0,"LogLevel":"Warning","Category":"MicroElements.NSwag.FluentValidation.FluentValidationSchemaProcessor","Message":"Error on apply rule \u0027NotEmpty\u0027 for property" "Exception":"System.MissingMethodException: Method not found: \u0027NJsonSchema.JsonObjectType NJsonSchema.JsonSchema.get_Type()\u0027.\n at MicroElements.NSwag.FluentValidation.NSwagFluentValidationRuleProvider.\u003C\u003Ec.\u003CCreateDefaultRules\u003Eb__1_6(IRuleContext\u00601 context)\n at MicroElements.OpenApi.FluentValidation.FluentValidationSchemaBuilder.ApplyRulesToSchema[TSchema](Type schemaType, IEnumerable\u00601 schemaPropertyNames, IValidator validator, ILogger logger, ISchemaGenerationContext\u00601 schemaGenerationContext) in /home/runner/work/MicroElements.Swashbuckle.FluentValidation/MicroElements.Swashbuckle.FluentValidation/src/MicroElements.OpenApi.FluentValidation/FluentValidation/FluentValidationSchemaBuilder.cs:line 74","State":{"Message":"Error on apply rule \u0027NotEmpty\u0027 for property [u0027Property].

and

{"EventId":0,"LogLevel":"Warning","Category":"MicroElements.NSwag.FluentValidation.FluentValidationSchemaProcessor","Message":"Applying IncludeRules for type \u0027Type\u0027 fails","Exception":"System.MissingMethodException: Method not found: \u0027Void NJsonSchema.Generation.SchemaProcessorContext..ctor(System.Type, NJsonSchema.JsonSchema, NJsonSchema.Generation.JsonSchemaResolver, NJsonSchema.Generation.JsonSchemaGenerator, NJsonSchema.Generation.JsonSchemaGeneratorSettings)\u0027.\n at MicroElements.NSwag.FluentValidation.SwashbuckleSchemaProvider.GetSchemaForType(Type type)\n at MicroElements.OpenApi.FluentValidation.FluentValidationSchemaBuilder.AddRulesFromIncludedValidators[TSchema](ValidatorContext validatorContext, ILogger logger, ISchemaGenerationContext\u00601 schemaGenerationContext) in /home/runner/work/MicroElements.Swashbuckle.FluentValidation/MicroElements.Swashbuckle.FluentValidation/src/MicroElements.OpenApi.FluentValidation/FluentValidation/FluentValidationSchemaBuilder.cs:line 154\n at MicroElements.NSwag.FluentValidation.FluentValidationSchemaProcessor.Process(SchemaProcessorContext context)

I guess it occurs because the new NJsonSchema version (11.1.0) is used in the new NSwag dll, and the older one is used in MicroElements. Could you fix this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions