-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
Custom examples not working when file is generated #1060
Comments
Hey there, please provide a full example, or at least a formatted message that can be copy/pasted please use markdown code formatting |
@derberg This is the sample document (full document is too long). There are no error, the file gets generated, but the examples are generic instead of the examples I listed. I want the generated html file to have the example I listed. When I preview the async file with VS Code Extension the examples are the ones I defined and not generated ones, but once I generate html file the genric examples show up. Also defining example for each attribute is really not an option, because the file is so long and examples are also very long. |
@derberg sorry for such a late response but we were in the middle of asyncapi v3 release and then also christmas break the problem is that you provide example in not a valid asyncapi way your message should look like: SessionStarted:
name: SessionStarted
title: Session Started
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/SessionPayload"
examples:
- payload:
SessionId: 660427
SessionNumber: "S-2023/2673"
SessionSourceId: 1
ParkingFrom: null
ParkingTo: null
ConnectedFrom: "2023-10-30T07: 53: 03.557Z"
ConnectedTo: null
From: "2023-10-30T07: 53: 03.557Z"
To: null
MeterStart: 6804.3
MeterEnd: null
Consumption: null
Power: null
RoamingTypeId: 0
RoamingSessionId: null
InstanceRoamingPlatformId: null
Object:
Id: 75691
ObjectFriendlyCode: "1" since message can also have headers, then an example object has a structure that enable you to provide example of header and payload separately + you can have multiple examples -> https://v2.asyncapi.com/docs/reference/specification/v2.6.0#messageExampleObject here you can see fixed document but still with errors as your example do not match provided AsyncAPI Schema |
7 days passed. I think we can assume provided solution will work. Closing. Feel free to drop a comment in case it is not really resolved |
Describe the bug
I defined custom payload example, but when I generate documentation from html template, the examples are generic ("string", 0, "timestamp").
How to Reproduce
I define my examples in messages like this:
HelpDeskTicketUserRaised:
name: HelpDeskTicketUserRaised
title: Help Desk Ticket User Raised
traits:
- $ref: './headers.yaml#/messageTraits/commonHeaders'
payload:
$ref: "./schemas.yaml#/UserRequestPayload"
example:
UserRequestId: 1
Number: T-2023/241
UserRequestMessage: '20'
ReportedBy:
User:
Id: 2
Email: john.doe@gmail.com
ExternalCode:
Expected behavior
Expected behaviour is that this data shows in generated html file instead of the generic examples. If I define the data in schema and for each attribute then it works, but in my case that is unacceptable since I have too much messages. Also I am using VS Code extension which uses the react-component and on the preview in VS Code the examples work fine. But once the html file is generated, only the generic examples show.
The text was updated successfully, but these errors were encountered: