html-template icon indicating copy to clipboard operation
html-template copied to clipboard

Blank HTML generated - but correct schema present in Javascript objects

Open frankjkelly opened this issue 9 months ago • 4 comments

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/[email protected] --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/[email protected] 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

frankjkelly avatar Mar 27 '25 13:03 frankjkelly

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.

github-actions[bot] avatar Mar 27 '25 13:03 github-actions[bot]

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

frankjkelly avatar Mar 27 '25 14:03 frankjkelly

hey there, did you try other commands, like instead of generate fromTemplate -o /app/output /app/asyncapi.yml @asyncapi/[email protected] --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.

derberg avatar Mar 27 '25 18:03 derberg

@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!

frankjkelly avatar Mar 27 '25 19:03 frankjkelly

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

derberg avatar Mar 31 '25 12:03 derberg

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] avatar Jul 30 '25 00:07 github-actions[bot]