microsoft/OpenAPI.NET.CSharpAnnotations

Contract decorations with late bound dependencies.

aaronlcope opened this issue · 2 comments

I have contracts that are decorated with attribute types that derive from ValidationAttribute. These custom types are bound at bootstrap via dependency injection. Is there a way to supply these late bound dependencies to the openapi generation process?

Currently the schema cannot be built until I've found a way to resolve these dependencies during generation.

Perhaps the OpenApiGeneratorConfig could open up a new property (e.g. - lateBoundDependencies) to take a generic list of types, which could added to or explicitly evaluated by the SchemaReferenceRegistry?

How might you suggest approaching this?

@aaronlcope have you tried providing the assembly that contains ValidationAttribute to the generation library? Also if you can share the generation errors returned by the library that would help investigate this.

First, thank you for the response. Second, Correct, I did this; the assembly containing our extensions of the ValidationAttribute are included (.xml & .dll). But I feel at this point the problem is on my side, with being able to satisfy the dependency in our own source code. That part I'm working through. If I have a specific issue with the OpenApiGenerator process, I'll let you know. Thank you again for the response.