/// <summary>
        /// Confgures Swaschbuckle to provide additional metadata in methods which use FromQuery attribute so the API provided by DotVVM API generator is easier to use.
        /// </summary>
        public static void EnableDotvvmIntegration(this SwaggerDocsConfig options, Action <DotvvmApiOptions> configureOptions = null)
        {
            var apiOptions = new DotvvmApiOptions();

            configureOptions?.Invoke(apiOptions);

            var propertySerialization = new DefaultPropertySerialization();

            options.OperationFilter(() => new AddAsObjectAnnotationOperationFilter(propertySerialization));
            options.SchemaFilter(() => new AddTypeToModelSchemaFilter());
            options.DocumentFilter(() => new HandleKnownTypesDocumentFilter(apiOptions, propertySerialization));
        }
 public HandleKnownTypesDocumentFilter(IOptions <DotvvmApiOptions> apiOptions)
 {
     this.apiOptions            = apiOptions;
     this.propertySerialization = new DefaultPropertySerialization();
 }
Exemple #3
0
 public AddAsObjectOperationFilter(IOptions <DotvvmApiOptions> knownTypesOptions)
 {
     this.knownTypesOptions     = knownTypesOptions.Value;
     this.propertySerialization = new DefaultPropertySerialization();
 }