Skip to content

Blank HTML generated - but correct schema present in Javascript objects #718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
frankjkelly opened this issue Mar 27, 2025 · 5 comments
Open

Comments

@frankjkelly
Copy link

Could be a bug could be just me as a newbie

Just got around from updating from the old npm and ag way of doing things to the new way.
Since I am on Apple Silicon and hit some issues I decided to use docker and mount all the files I needed

docker run --rm -it --user=root \
-v ./specs/services/compute.yml:/app/asyncapi.yml \
-v ./specs/schemas/schemas.yml:/schemas/schemas.yml \
-v ./specs/messages/messages.yml:/messages/messages.yml \
-v ./build/generated-docs/html/compute:/app/output \
asyncapi/cli generate fromTemplate -o /app/output /app/asyncapi.yml @asyncapi/html-template@3.2.0 --use-new-generator --force-write

I fixed all the issues in my schema and it runs without complaint

Generation in progress. Keep calm and wait a bit
[BABEL] Note: The code generator has deoptimised the styling of /libraries/node_modules/generator-v2/node_modules/@asyncapi/html-template/template/js/asyncapi-ui.min.js as it exceeds the max of 500KB.
Check out your shiny new generated files at /app/output.

but when I look at the generated output I see a header and no content. Any ideas? Using @asyncapi/html-template@3.0.0 I can see the full schema in the page source - see below

Image

Image

Environment: Apple Silicon

Image

Please let me know if you need any more information

Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@frankjkelly
Copy link
Author

FYI I'm a JS newbie too but the first error I see in the JavaScript is here. No idea if this is helpful or not.

Image

@derberg
Copy link
Member

derberg commented Mar 27, 2025

hey there, did you try other commands, like instead of generate fromTemplate -o /app/output /app/asyncapi.yml @asyncapi/html-template@3.2.0 --use-new-generator --force-write just do validate to see if other outputs work?

but to be honest - your command is completely fine so my guess there is something missing in your AsyncAPI document - maybe it is valid but do not provide the necessary data. Can you share it? best if you put it in https://studio.asyncapi.com/ and then grab a link using its sharing functionality and put a link here. Or just paste the document as markdown code here - whatever you prefer.

@frankjkelly
Copy link
Author

@derberg Thanks - unfortunately I'd be uploading some pretty sensitive information.
I think I am going to take another approach and roll back my changes back to asyncapi:2.0.0 and work through the errors

What's odd is I get so many errors in some schemas and not in others

Diagnostic err: Operation should have an "operationId" field defined. in path ["channels","persistent://platform2/event/interaction","publish"] starting L15 C12, ending L26 C78
Diagnostic err: Property "oneOf" is not expected to be here in path ["channels","persistent://platform2/event/interaction","publish","message","oneOf"] starting L17 C14, ending L26 C78
Diagnostic err: "8" property must have required property "oneOf" in path ["components","messages","intervalNext"] starting L383 C17, ending L479 C36
Diagnostic err: "8" property must match "then" schema in path ["components","messages","intervalNext"] starting L383 C17, ending L479 C36
Diagnostic err: Property "name" is not expected to be here in path ["components","messages","intervalNext","name"] starting L384 C12, ending L384 C29
Diagnostic err: Property "title" is not expected to be here in path ["components","messages","intervalNext","title"] starting L385 C13, ending L385 C32
Diagnostic err: Property "summary" is not expected to be here in path ["components","messages","intervalNext","summary"] starting L386 C15, ending L386 C28
Diagnostic err: Property "description" is not expected to be here in path ["components","messages","intervalNext","description"] starting L387 C19, ending L387 C138
Diagnostic err: Property "payload" is not expected to be here in path ["components","messages","intervalNext","payload"] starting L390 C14, ending L479 C36
Diagnostic err: "allOf" property type must be object,boolean in path ["components","messages","intervalNext","payload","properties","payload","properties","previousInterval","properties","allOf"] starting L403 C24, ending L404 C92
Diagnostic err: must be object,boolean in path ["components","messages","intervalNext","payload","properties","payload","properties","previousInterval","properties","allOf"] starting L403 C24, ending L404 C92
Diagnostic err: Property "headers" is not expected to be here in path ["components","schemas","headers"] starting L125 C12, ending L130 C85
Generation failed
Generator Error: Input is not a correct AsyncAPI document so it cannot be processed.

Is there some way to figure out which errors are critical e.g. the one's with should seem like they are warnings. The others I guess are errors.

What's really odd is this one

Diagnostic err: Property "oneOf" is not expected to be here in path ["channels","persistent://platform2/event/interaction","publish","message","oneOf"] starting L17 C14, ending L26 C78

I was pretty sure that oneOf was supported for a message
Foe example

channels:
  "persistent://platform2/event/interaction":
    publish:
      message:
        oneOf:
          - $ref: '../messages/messages.yml#/components/messages/endpointClosed'
          - $ref: '../messages/messages.yml#/components/messages/endpointCreated'
          - $ref: '../messages/messages.yml#/components/messages/endpointOpened'
          - $ref: '../messages/messages.yml#/components/messages/interactionClosed'
          - $ref: '../messages/messages.yml#/components/messages/interactionCreated'
          - $ref: '../messages/messages.yml#/components/messages/interactionOpened'
          - $ref: '../messages/messages.yml#/components/messages/interactionSegmentInserted'
          - $ref: '../messages/messages.yml#/components/messages/intervalOpened'
          - $ref: '../messages/messages.yml#/components/messages/intervalNext'

but when I remove

          - $ref: '../messages/messages.yml#/components/messages/intervalNext'

ALL the errors go away - so not really sure how to debug this if some of the errors are "false leads".

Any advice as to find which error is the root cause? Thanks!

@derberg
Copy link
Member

derberg commented Mar 31, 2025

can't you anonymize sensitive info? I would prefer not to bring my brain back into the past and v2 😄

when I look at below screen shot you shared, I immediately have 2 things to mention:

  • I see servers and channels in the components. Components object is only for reusability, so do you have servers and channels in your file also as standalone objects on the root? (not visible in screen shot)
  • I see you have AsyncAPI v3 but channel still uses subscribe semantics and oneOf for messages. This is not what it should be like in v3. I recall such errors whenever I ask chatGPT to generate AsyncAPI document v3 for me.
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants