From a70b60ebe346c20cf44c8db9aec4da859220119a Mon Sep 17 00:00:00 2001 From: Karuna Tata <74637789+starlightknown@users.noreply.github.com> Date: Fri, 16 Dec 2022 18:33:59 +0530 Subject: [PATCH] feat: new invalid asyncapi template (#524) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maciej UrbaƄczyk --- src/components/Modals/NewFileModal.tsx | 10 ++++++++ src/examples/index.tsx | 12 +++++++++- src/examples/tutorials/invalid.yml | 33 ++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/examples/tutorials/invalid.yml diff --git a/src/components/Modals/NewFileModal.tsx b/src/components/Modals/NewFileModal.tsx index 105a28050..17a8198ca 100644 --- a/src/components/Modals/NewFileModal.tsx +++ b/src/components/Modals/NewFileModal.tsx @@ -52,6 +52,7 @@ export const NewFileModal = create(() => { const realLifeExamples = examples.filter((template) => template.type === 'real-example'); const templates = examples.filter((template) => template.type === 'protocol-example'); + const tutorials = examples.filter((template) => template.type === 'tutorial-example'); return ( { })} +
+ Tutorials +
+ {tutorials.map(({ title, description, template }) => { + const isSelected = selectedTemplate.title === title; + return setSelectedTemplate({ title, template })} />; + })} +
+
Don't see what you're looking for?
<>An example of an invalid AsyncAPI document. This is only for educational purposes, to learn document validation., + template: invalid, + type: templateTypes.tutorial + }, { title: 'Apache Kafka', description: () => <>A framework implementation of a software bus using stream-processing. Open Source developed by the Apache Software Foundation., diff --git a/src/examples/tutorials/invalid.yml b/src/examples/tutorials/invalid.yml new file mode 100644 index 000000000..173dfe39b --- /dev/null +++ b/src/examples/tutorials/invalid.yml @@ -0,0 +1,33 @@ +asyncapi: '1.0.0' +info: + title: Streetlights API + version: '1.0.0' + license: + name: Apache 2.0 + url: 'https://www.apache.org/licenses/LICENSE-2.0' +servers: + mosquitto: + url: mqtt://test.mosquitto.org + protocol: mqtt +channels: + light/measured: + publish: + summary: Inform about environmental lighting conditions for a particular streetlight. + operationId: onLightMeasured + message: + name: LightMeasured + payload: + type: object + properties: + id: + type: integer + minimum: true + description: Id of the streetlight. + lumens: + type: integer + minimum: 0 + description: Light intensity measured in lumens. + sentAt: + type: integer + format: date-time + description: Date and time when the message was sent.