diff --git a/src/main/kotlin/com/asyncapi/plugin/idea/actions/CreateAsyncAPISpecification.kt b/src/main/kotlin/com/asyncapi/plugin/idea/actions/CreateAsyncAPISpecification.kt index ac61c1a..a102166 100644 --- a/src/main/kotlin/com/asyncapi/plugin/idea/actions/CreateAsyncAPISpecification.kt +++ b/src/main/kotlin/com/asyncapi/plugin/idea/actions/CreateAsyncAPISpecification.kt @@ -21,6 +21,8 @@ class CreateAsyncAPISpecification: CreateFileFromTemplateAction( .setTitle("New API Specification") .addKind("AsyncAPI 2 (.yaml)", Icons.ASYNCAPI_ICON, "AsyncAPI schema (yaml).yaml") .addKind("AsyncAPI 2 (.json)", Icons.ASYNCAPI_ICON, "AsyncAPI schema (json).json") + .addKind("AsyncAPI 3 (.yaml)", Icons.ASYNCAPI_ICON, "AsyncAPI schema 3 (yaml).yaml") + .addKind("AsyncAPI 3 (.json)", Icons.ASYNCAPI_ICON, "AsyncAPI schema 3 (json).json") } override fun getActionName(directory: PsiDirectory?, newName: String, templateName: String?): String { diff --git a/src/main/resources/fileTemplates/internal/AsyncAPI schema 3 (json).json.ft b/src/main/resources/fileTemplates/internal/AsyncAPI schema 3 (json).json.ft new file mode 100644 index 0000000..5598801 --- /dev/null +++ b/src/main/resources/fileTemplates/internal/AsyncAPI schema 3 (json).json.ft @@ -0,0 +1,46 @@ +{ + "asyncapi": "3.0.0", + "info": { + "title": "Account Service", + "version": "1.0.0", + "description": "This service is in charge of processing user signups :rocket:" + }, + "channels": { + "userSignedup": { + "address": "user/signedup", + "messages": { + "userSignedupMessage": { + "\$ref": "#/components/messages/UserSignedUp" + } + } + } + }, + "operations": { + "processUserSignups": { + "action": "receive", + "channel": { + "\$ref": "#/channels/userSignedup" + } + } + }, + "components": { + "messages": { + "UserSignedUp": { + "payload": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "Name of the user" + }, + "email": { + "type": "string", + "format": "email", + "description": "Email of the user" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/fileTemplates/internal/AsyncAPI schema 3 (yaml).yaml.ft b/src/main/resources/fileTemplates/internal/AsyncAPI schema 3 (yaml).yaml.ft new file mode 100644 index 0000000..3d34f69 --- /dev/null +++ b/src/main/resources/fileTemplates/internal/AsyncAPI schema 3 (yaml).yaml.ft @@ -0,0 +1,29 @@ +asyncapi: 3.0.0 +info: + title: Account Service + version: 1.0.0 + description: "This service is in charge of processing user signups :rocket:" +channels: + userSignedup: + address: "user/signedup" + messages: + userSignedupMessage: + \$ref: "#/components/messages/UserSignedUp" +operations: + processUserSignups: + action: "receive" + channel: + \$ref: "#/channels/userSignedup" +components: + messages: + UserSignedUp: + payload: + type: object + properties: + displayName: + type: string + description: Name of the user + email: + type: string + format: email + description: Email of the user \ No newline at end of file