Comments (4)
Hey there, please provide a full example, or at least a formatted message that can be copy/pasted
please use markdown code formatting
from generator.
asyncapi: '2.6.0'
info:
title: Message Queues Documentation
version: '1.0.0'
description: This is a documentation for message queues
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
servers:
test:
url: test.mykafkacluster.org:8092
protocol: kafka-secure
description: Test broker
security:
- saslScram: []
defaultContentType: application/json
channels:
# Session
"{operatorId}.*.session.started":
description: desc
parameters:
operatorId:
$ref: '#/components/parameters/operatorId'
publish:
operationId: sessionStarted
traits:
- $ref: '#/components/operationTraits/kafka'
message:
$ref: '#/components/messages/SessionStarted'
tags:
- name: Session
components:
messages:
SessionStarted:
name: SessionStarted
title: Session Started
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/SessionPayload"
example:
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"
schemas:
SessionPayload:
type: object
properties:
SessionId:
type: integer
format: int64
description: Unique ID of the session
SessionNumber:
type: string
description: Friendly ID of the session
SessionSourceId:
type: integer
format: int16
description: 1 - Local charge point (CSO); 2 - Roaming CDR.
ParkingFrom:
type: string
format: date-time
description: Parking start time. Normally empty if charger is not able to detect parking time.
ParkingTo:
type: string
format: date-time
description: Parking end time. Normally empty if charger is not able to detect parking time.
ConnectedFrom:
type: string
format: date-time
ConnectedTo:
type: string
format: date-time
From:
type: string
format: date-time
To:
type: string
format: date-time
MeterStart:
type: string
format: date-time
MeterEnd:
type: string
format: date-time
Consumption:
type: number
format: float
Power:
type: number
format: float
RoamingTypeId:
type: integer
format: int32
RoamingSessionId:
type: string
description: Roaming session id, collected from roaming partner, used as reference when communicating with partner.
InstanceRoamingPlatformId:
type: integer
format: int32
Object:
type: object
properties:
Id:
type: integer
format: int32
ObjectFriendlyCode:
type: string
securitySchemes:
saslScram:
type: scramSha256
description: Provide your username and password for SASL/SCRAM authentication
parameters:
operatorId:
description: Instance ID. Every tenant has unique ID.
schema:
type: integer
format: int32
messageTraits:
commonHeaders:
headers:
type: object
properties:
my-app-header:
type: integer
minimum: 0
maximum: 100
operationTraits:
kafka:
bindings:
kafka:
clientId: my-app-id
@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.
from generator.
@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
from generator.
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
from generator.
Related Issues (20)
- Blank page when generating html doc HOT 6
- Installing 'source-map-support' package results in wrong call stack HOT 1
- AsyncAPi to MD - TypeError: message.messageId is not a function HOT 2
- Shared avro model results in incorrect AsyncAPI document HOT 4
- Path contains invalid characters HOT 3
- Bug: Need to perform the testing in the exlusive env. HOT 1
- Bug: Need to perform exclusive testing in generator HOT 1
- Improve arborist (npm installation) to have no hacks HOT 4
- Allow $$operation$$ file template HOT 2
- `noOverwriteGlobs` will not work in majority of cases in templates using react HOT 10
- Proposal for mentorship of potential maintainers of generator -> `Becoming a Maintainer of AsyncAPI Generator` HOT 22
- [BUG] Demo from homepage does not work HOT 7
- Need to add proper options to generate the template from private registory using CLI HOT 2
- Allowing Generator to pull the templates from the private GitHub Repository
- [Docs Bug 🐞 report]: The `template-constant` link is broken at the generator docs HOT 6
- [Docs Bug 🐞 report]: The `AsyncAPI document` button is broken at the generator docs HOT 3
- [📑 Docs]: Improve documentation related to `File templates` feature HOT 5
- `conditionalFiles` feature is broken when template uses `server` special parameter HOT 1
- Incoming changes for generator
- Support platform generator type templates to infrastructure as code HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generator.