asyncapi / saunter

Saunter is a code-first AsyncAPI documentation generator for dotnet.
https://www.asyncapi.com/
MIT License
194 stars 55 forks source link

Kafka security schemes invalid specification #171

Open ch-ti8m-michalpenka opened 10 months ago

ch-ti8m-michalpenka commented 10 months ago

I'm trying to render the following async api:

asyncapi: 2.2.0
info:
  title: My Kafka topic
  version: 1.0.0
servers:
  demo:
    url: myclester.org:8092
    protocol: kafka-secure
    security:
      - mysecurity
components:
  securitySchemes:
    mysecurity:
        type: X509

I try to add a security scheme to components like below in a document filter:


            document.Components.SecuritySchemes.Add(
                new KeyValuePair<string, SecurityScheme>(
                    "mysecurity",
                    new SecurityScheme(SecuritySchemeType.X509)));

When I try to render the html, I get the following output on the page itself:

Error: There were errors validating the AsyncAPI document.
88./components/securitySchemes/mysecurity should have required property '$ref'
91./components/securitySchemes/mysecurity should NOT have additional properties
92./components/securitySchemes/mysecurity should NOT have additional properties
93./components/securitySchemes/mysecurity should NOT have additional properties
94./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
96./components/securitySchemes/mysecurity should NOT have additional properties
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
90./components/securitySchemes/mysecurity/description should be string
91./components/securitySchemes/mysecurity should NOT have additional properties
93./components/securitySchemes/mysecurity should NOT have additional properties
94./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
96./components/securitySchemes/mysecurity should NOT have additional properties
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
92./components/securitySchemes/mysecurity/in should be string
92./components/securitySchemes/mysecurity/in should be equal to one of the allowed values
90./components/securitySchemes/mysecurity/description should be string
91./components/securitySchemes/mysecurity should NOT have additional properties
92./components/securitySchemes/mysecurity should NOT have additional properties
93./components/securitySchemes/mysecurity should NOT have additional properties
94./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
96./components/securitySchemes/mysecurity should NOT have additional properties
90./components/securitySchemes/mysecurity/description should be string
91./components/securitySchemes/mysecurity should NOT have additional properties
92./components/securitySchemes/mysecurity should NOT have additional properties
93./components/securitySchemes/mysecurity should NOT have additional properties
94./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
96./components/securitySchemes/mysecurity should NOT have additional properties
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
90./components/securitySchemes/mysecurity/description should be string
91./components/securitySchemes/mysecurity should NOT have additional properties
92./components/securitySchemes/mysecurity should NOT have additional properties
93./components/securitySchemes/mysecurity should NOT have additional properties
94./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
96./components/securitySchemes/mysecurity should NOT have additional properties
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
90./components/securitySchemes/mysecurity/description should be string
91./components/securitySchemes/mysecurity should NOT have additional properties
92./components/securitySchemes/mysecurity should NOT have additional properties
94./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
96./components/securitySchemes/mysecurity should NOT have additional properties
93./components/securitySchemes/mysecurity/scheme should be string
90./components/securitySchemes/mysecurity/description should be string
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
91./components/securitySchemes/mysecurity should NOT have additional properties
92./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
96./components/securitySchemes/mysecurity should NOT have additional properties
93./components/securitySchemes/mysecurity/scheme should be string
93./components/securitySchemes/mysecurity/scheme should be equal to one of the allowed values
94./components/securitySchemes/mysecurity/bearerFormat should be string
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
90./components/securitySchemes/mysecurity/description should be string
93./components/securitySchemes/mysecurity should NOT have additional properties
94./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
96./components/securitySchemes/mysecurity should NOT have additional properties
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
91./components/securitySchemes/mysecurity/name should be string
92./components/securitySchemes/mysecurity/in should be string
92./components/securitySchemes/mysecurity/in should be equal to one of the allowed values
90./components/securitySchemes/mysecurity/description should be string
88./components/securitySchemes/mysecurity should match exactly one schema in oneOf
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
90./components/securitySchemes/mysecurity/description should be string
95./components/securitySchemes/mysecurity/flows should be object
91./components/securitySchemes/mysecurity should NOT have additional properties
92./components/securitySchemes/mysecurity should NOT have additional properties
93./components/securitySchemes/mysecurity should NOT have additional properties
94./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
90./components/securitySchemes/mysecurity/description should be string
96./components/securitySchemes/mysecurity/openIdConnectUrl should be string
91./components/securitySchemes/mysecurity should NOT have additional properties
92./components/securitySchemes/mysecurity should NOT have additional properties
93./components/securitySchemes/mysecurity should NOT have additional properties
94./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
96./components/securitySchemes/mysecurity should NOT have additional properties
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
90./components/securitySchemes/mysecurity/description should be string
91./components/securitySchemes/mysecurity should NOT have additional properties
92./components/securitySchemes/mysecurity should NOT have additional properties
93./components/securitySchemes/mysecurity should NOT have additional properties
94./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
96./components/securitySchemes/mysecurity should NOT have additional properties
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
90./components/securitySchemes/mysecurity/description should be string
91./components/securitySchemes/mysecurity should NOT have additional properties
92./components/securitySchemes/mysecurity should NOT have additional properties
93./components/securitySchemes/mysecurity should NOT have additional properties
94./components/securitySchemes/mysecurity should NOT have additional properties
95./components/securitySchemes/mysecurity should NOT have additional properties
96./components/securitySchemes/mysecurity should NOT have additional properties
89./components/securitySchemes/mysecurity/type should be equal to one of the allowed values
90./components/securitySchemes/mysecurity/description should be string
88./components/securitySchemes/mysecurity should match exactly one schema in oneOf
88./components/securitySchemes/mysecurity should match exactly one schema in oneOf
88./components/securitySchemes/mysecurity should match exactly one schema in oneOf

I believe it is because the json contains the following (I believe it is due to wrong serialization, ignorenull should be used):


    "securitySchemes": {
      "mysecurity": {
        "type": "X509",
        "description": null,
        "name": null,
        "in": null,
        "scheme": null,
        "bearerFormat": null,
        "flows": null,
        "openIdConnectUrl": null
      }
    }

But even then, if this would render correct json, how do I then reference my security scheme component in the server via code?

Thanks for fixing/advising.