faststream icon indicating copy to clipboard operation
faststream copied to clipboard

Bug: documentation schema hosting returns blank page

Open yann-combarnous opened this issue 1 year ago • 5 comments

Describe the bug Following the tutorial for the AsyncAPI documentation generation, generation works, but hosting with FastStream returns a blank page.

How to reproduce Here is the generated HTML by FastStream:

   <!DOCTYPE html>
   <html>
   <head>
    
   <title>FastStream AsyncAPI</title>
    
   <link rel="icon" href="https://www.asyncapi.com/favicon.ico">
   <link rel="icon" type="image/png" sizes="16x16" href="https://www.asyncapi.com/favicon-16x16.png">
   <link rel="icon" type="image/png" sizes="32x32" href="https://www.asyncapi.com/favicon-32x32.png">
   <link rel="icon" type="image/png" sizes="194x194" href="https://www.asyncapi.com/favicon-194x194.png">
    
   <link rel="stylesheet" href="https://unpkg.com/@asyncapi/[email protected]/styles/default.min.css">
    
   </head>
    
   <style>
   html {
   font-family: ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sns,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;
   line-height: 1.5;
   }
   </style>
    
   <body>
   <div id="asyncapi"></div>
    
   <script src="https://unpkg.com/@asyncapi/[email protected]/browser/standalone/index.js"></script>
   <script>
    
   AsyncApiStandalone.render({"schema": "{\"asyncapi\":\"2.6.0\",\"defaultContentType\":\"application/json\",\"info\":{\"title\":\"FastStream\",\"version\":\"0.1.0\",\"description\":\"\"},\"servers\":{\"development\":{\"url\":\"xyz.confluent.cloud:9092\",\"protocol\":\"kafka-secure\",\"protocolVersion\":\"auto\",\"security\":[{\"oauthbearer\":[]}]}},\"channels\":{\"topic1:Subscriber\":{\"servers\":[\"development\"],\"bindings\":{\"kafka\":{\"topic\":\"topic1\",\"bindingVersion\":\"0.4.0\"}},\"subscribe\":{\"message\":{\"$ref\":\"#/components/messages/topic1:Subscriber:Message\"}}}},\"components\":{\"messages\":{\"topic1:Subscriber:Message\":{\"title\":\"topic1:Subscriber:Message\",\"correlationId\":{\"location\":\"$message.header#/correlation_id\"},\"payload\":{\"$ref\":\"#/components/schemas/Subscriber:Message:Payload\"}}},\"schemas\":{\"Subscriber:Message:Payload\":{\"title\":\"Subscriber:Message:Payload\"}},\"securitySchemes\":{\"oauthbearer\":{\"type\":\"oauthBearer\"}}}}", "config": {"show": {"sidebar": true, "info": true, "servers": true, "operations": true, "messages": true, "schemas": true, "errors": true}, "expand": {"messageExamples": true}, "sidebar": {"showServers": "byDefault", "showOperations": "byDefault"}}}, document.getElementById('asyncapi'));
    
   </script>
   </body>
   </html>
from faststream import FastStream
...

And/Or steps to reproduce the behavior:

  1. ...

Expected behavior Documentation display asyncAPI doc

Observed behavior Browser returns blank page, no error.

Screenshots N/A

Environment Running FastStream 0.5.23 with CPython 3.12.4 on Darwin

Additional context N/A

yann-combarnous avatar Sep 19 '24 14:09 yann-combarnous

@yann-combarnous can you check generated schema by this tool?

https://studio.asyncapi.com/

Probably, it just not correct

Lancetnik avatar Sep 20 '24 09:09 Lancetnik

Seems like the problem in ouath bearer schema

Lancetnik avatar Sep 20 '24 11:09 Lancetnik

oauthBearer is an invalid type, we have to refactor this place

Lancetnik avatar Sep 20 '24 11:09 Lancetnik

It will be nice if there is not an empty page, but a description of the error - https://github.com/asyncapi/asyncapi-react/issues/1048

KrySeyt avatar Sep 20 '24 12:09 KrySeyt

oauthBearer is an invalid type, we have to refactor this place

Indeed, this is where the issue is, even though my code is valid.

For reference if it helps, here is my working code:

from faststream.confluent import KafkaBroker
from faststream.security import SASLOAuthBearer

broker = KafkaBroker(
            f"{kafka_creds['bootstrap_server_url']}:9092",
            config=kafka_creds["read_config"],
            security=SASLOAuthBearer(use_ssl=True),
        )

yann-combarnous avatar Sep 20 '24 12:09 yann-combarnous

@AceTheCreator can you help us here, please?

Lancetnik avatar Nov 07 '24 16:11 Lancetnik

Closed by #1926

Lancetnik avatar Nov 19 '24 16:11 Lancetnik