diff --git a/.gitignore b/.gitignore
index 758b4e3..1651553 100644
--- a/.gitignore
+++ b/.gitignore
@@ -206,6 +206,7 @@ PublishScripts/
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
+local-nuget-source/
# Microsoft Azure Build Output
csx/
diff --git a/Saunter.sln b/Saunter.sln
index c746b5e..40ce7d4 100644
--- a/Saunter.sln
+++ b/Saunter.sln
@@ -21,6 +21,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitattributes = .gitattributes
CHANGELOG.md = CHANGELOG.md
.github\workflows\ci.yaml = .github\workflows\ci.yaml
+ nuget.config = nuget.config
README.md = README.md
.github\workflows\release.yaml = .github\workflows\release.yaml
EndProjectSection
@@ -35,6 +36,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsyncAPI.Saunter.Generator.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsyncAPI.Saunter.Generator.Build", "src\AsyncAPI.Saunter.Generator.Build\AsyncAPI.Saunter.Generator.Build.csproj", "{A320E670-5CB0-4815-AF67-D8D09FC92A2A}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncAPI.Saunter.Generator.Build.Tests", "test\AsyncAPI.Saunter.Generator.Build.Tests\AsyncAPI.Saunter.Generator.Build.Tests.csproj", "{61142B10-7B49-436E-AE32-2737658BD1E5}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -141,6 +144,18 @@ Global
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Release|x64.Build.0 = Release|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Release|x86.ActiveCfg = Release|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Release|x86.Build.0 = Release|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|x64.Build.0 = Debug|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|x86.Build.0 = Debug|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Release|x64.ActiveCfg = Release|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Release|x64.Build.0 = Release|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Release|x86.ActiveCfg = Release|Any CPU
+ {61142B10-7B49-436E-AE32-2737658BD1E5}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -154,6 +169,7 @@ Global
{6C102D4D-3DA4-4763-B75E-C15E33E7E94A} = {28D4C365-FDED-49AE-A97D-36202E24A55A}
{18AD0249-0436-4A26-9972-B97BA6905A54} = {6491E321-2D02-44AB-9116-D722FE169595}
{A320E670-5CB0-4815-AF67-D8D09FC92A2A} = {28D4C365-FDED-49AE-A97D-36202E24A55A}
+ {61142B10-7B49-436E-AE32-2737658BD1E5} = {6491E321-2D02-44AB-9116-D722FE169595}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2F85D9DA-DBCF-4F13-8C42-5719F1469B2E}
diff --git a/examples/StreetlightsAPI/StreetlightsAPI.csproj b/examples/StreetlightsAPI/StreetlightsAPI.csproj
index 3185dff..dbc65c3 100644
--- a/examples/StreetlightsAPI/StreetlightsAPI.csproj
+++ b/examples/StreetlightsAPI/StreetlightsAPI.csproj
@@ -3,6 +3,8 @@
net6.0
false
+
+
true
json,yml
streetlights.{extension}
@@ -19,8 +21,28 @@
1701;1702;1591
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
diff --git a/nuget.config b/nuget.config
new file mode 100644
index 0000000..18e0fc8
--- /dev/null
+++ b/nuget.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/AsyncAPI.Saunter.Generator.Build/AsyncAPI.Saunter.Generator.Build.csproj b/src/AsyncAPI.Saunter.Generator.Build/AsyncAPI.Saunter.Generator.Build.csproj
index 04be28c..c7f4b63 100644
--- a/src/AsyncAPI.Saunter.Generator.Build/AsyncAPI.Saunter.Generator.Build.csproj
+++ b/src/AsyncAPI.Saunter.Generator.Build/AsyncAPI.Saunter.Generator.Build.csproj
@@ -15,13 +15,20 @@
https://github.com/asyncapi/saunter
true
true
- false
+ true
false
https://github.com/asyncapi/saunter
MIT
false
- 0.0.24
- tools/$(Configuration)
+ true
+ 1.0.0
+ bin/
+
+
+
+ 0.0.999-debug-$([System.DateTime]::Now.ToString('yyyyMMddHHmm'))
+ true
+ ../../local-nuget-source
diff --git a/src/AsyncAPI.Saunter.Generator.Build/readme.md b/src/AsyncAPI.Saunter.Generator.Build/readme.md
index 3f60164..eca774a 100644
--- a/src/AsyncAPI.Saunter.Generator.Build/readme.md
+++ b/src/AsyncAPI.Saunter.Generator.Build/readme.md
@@ -2,7 +2,7 @@
A nuget package to generate AsyncAPI specification files at build time, based on code-first attributes.
# Customizations
-The AsyncAPI spec generation can be configured through properties in the csproj-file (or .props files):
+The AsyncAPI spec generation can be configured through project properties in the csproj-file (or .props files):
```
diff --git a/src/AsyncAPI.Saunter.Generator.Cli/AsyncAPI.Saunter.Generator.Cli.csproj b/src/AsyncAPI.Saunter.Generator.Cli/AsyncAPI.Saunter.Generator.Cli.csproj
index 472cc32..8f079e0 100644
--- a/src/AsyncAPI.Saunter.Generator.Cli/AsyncAPI.Saunter.Generator.Cli.csproj
+++ b/src/AsyncAPI.Saunter.Generator.Cli/AsyncAPI.Saunter.Generator.Cli.csproj
@@ -26,6 +26,12 @@
1.0.1
+
+ 0.0.999-debug-$([System.DateTime]::Now.ToString('yyyyMMddHHmm'))
+ true
+ ../../local-nuget-source
+
+
diff --git a/src/AsyncAPI.Saunter.Generator.Cli/Commands/TofileInternal.cs b/src/AsyncAPI.Saunter.Generator.Cli/Commands/TofileInternal.cs
index 9ab87b0..56b42de 100644
--- a/src/AsyncAPI.Saunter.Generator.Cli/Commands/TofileInternal.cs
+++ b/src/AsyncAPI.Saunter.Generator.Cli/Commands/TofileInternal.cs
@@ -131,7 +131,8 @@ private static void WriteFile(string outputPath, Action writeAction)
if (outputPath != null)
{
- Console.WriteLine($"AsyncAPI {Path.GetExtension(outputPath)[1..]} successfully written to {outputPath}");
+ var sanitizedPath = Path.GetFullPath(outputPath);
+ Console.WriteLine($"AsyncAPI {Path.GetExtension(outputPath)[1..]} successfully written to {sanitizedPath}");
}
}
diff --git a/src/AsyncAPI.Saunter.Generator.Cli/SwashbuckleImport/CommandRunner.cs b/src/AsyncAPI.Saunter.Generator.Cli/SwashbuckleImport/CommandRunner.cs
index 29c982d..5b2d01e 100644
--- a/src/AsyncAPI.Saunter.Generator.Cli/SwashbuckleImport/CommandRunner.cs
+++ b/src/AsyncAPI.Saunter.Generator.Cli/SwashbuckleImport/CommandRunner.cs
@@ -56,7 +56,7 @@ public int Run(IEnumerable args)
if (_subRunners.Any() || !TryParseArgs(args, out IDictionary namedArgs))
{
- _output.WriteLine($"Input: {string.Join(' ', args)}");
+ //_output.WriteLine($"Input: {string.Join(' ', args)}"); // Useful for debugging
PrintUsage();
return 1;
}
diff --git a/test/AsyncAPI.Saunter.Generator.Build.Tests/AsyncAPI.Saunter.Generator.Build.Tests.csproj b/test/AsyncAPI.Saunter.Generator.Build.Tests/AsyncAPI.Saunter.Generator.Build.Tests.csproj
new file mode 100644
index 0000000..de4f84f
--- /dev/null
+++ b/test/AsyncAPI.Saunter.Generator.Build.Tests/AsyncAPI.Saunter.Generator.Build.Tests.csproj
@@ -0,0 +1,28 @@
+
+
+
+ net8.0
+ enable
+
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/AsyncAPI.Saunter.Generator.Build.Tests/StreetlightsApiBuildTests.cs b/test/AsyncAPI.Saunter.Generator.Build.Tests/StreetlightsApiBuildTests.cs
new file mode 100644
index 0000000..061d403
--- /dev/null
+++ b/test/AsyncAPI.Saunter.Generator.Build.Tests/StreetlightsApiBuildTests.cs
@@ -0,0 +1,74 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using AsyncAPI.Saunter.Generator.Cli.Tests;
+using Shouldly;
+using Xunit.Abstractions;
+
+namespace AsyncAPI.Saunter.Generator.Build.Tests;
+
+public class StreetlightsApiBuildTests(ITestOutputHelper output)
+{
+ private string Run(string file, string args, string workingDirectory, int expectedExitCode = 0)
+ {
+ var process = Process.Start(new ProcessStartInfo(file)
+ {
+ Arguments = args,
+ WorkingDirectory = workingDirectory,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ UseShellExecute = false,
+ });
+ process.WaitForExit(TimeSpan.FromSeconds(20));
+ var stdOut = process.StandardOutput.ReadToEnd().Trim();
+ var stdError = process.StandardError.ReadToEnd().Trim();
+ output.WriteLine($"### Output of \"{file} {args}\"");
+ output.WriteLine(stdOut);
+ output.WriteLine(stdError);
+
+ process.ExitCode.ShouldBe(expectedExitCode);
+ return stdOut;
+ }
+
+ private const string csprojPath = "../../../../../examples/StreetlightsAPI/StreetlightsAPI.csproj";
+
+ [Fact]
+ public void BuildingCsprojGeneratesSpecFilesTest()
+ {
+ var pwd = Directory.GetCurrentDirectory();
+ var csproj = Path.GetFullPath(Path.Combine(pwd, csprojPath));
+ output.WriteLine($"Current working directory: {pwd}");
+ output.WriteLine($"Csproj under test: {csproj}");
+ File.Exists(csproj).ShouldBeTrue();
+
+ var csprojDir = Path.GetDirectoryName(csproj);
+ var specDir = Path.Combine(csprojDir, "specs");
+
+ // Spec files should have been generated during the builds of the solution
+ Directory.GetFiles(specDir).Length.ShouldBe(2, $"#Spec files initial, path: {specDir}");
+ File.ReadAllText(Path.Combine(specDir, "streetlights.yml")).ShouldBe(ExpectedSpecFiles.Yml_v2_6, "yml");
+ File.ReadAllText(Path.Combine(specDir, "streetlights.json")).ShouldBe(ExpectedSpecFiles.Json_v2_6, "json");
+
+ // Delete spec files
+ foreach (var file in Directory.EnumerateFiles(specDir))
+ {
+ File.Delete(file);
+ }
+ Directory.GetFiles(specDir).Length.ShouldBe(0, $"#Spec files after deleting them all, path: {specDir}");
+
+ // Run build
+ var stdOut = this.Run("dotnet", "build", csprojDir);
+ stdOut.ShouldContain($"AsyncAPI json successfully written to {Path.Combine(specDir, "streetlights.json")}");
+ stdOut.ShouldContain($"AsyncAPI yml successfully written to {Path.Combine(specDir, "streetlights.yml")}");
+ stdOut.ShouldContain("Build succeeded.");
+ stdOut.ShouldContain("0 Warning(s)");
+ stdOut.ShouldContain("0 Error(s)");
+
+ // Check that spec files are actually re-generated
+ Directory.GetFiles(specDir).Length.ShouldBe(2, $"#Spec files after running build, path: {specDir}");
+ File.ReadAllText(Path.Combine(specDir, "streetlights.yml")).ShouldBe(ExpectedSpecFiles.Yml_v2_6, "yml");
+ File.ReadAllText(Path.Combine(specDir, "streetlights.json")).ShouldBe(ExpectedSpecFiles.Json_v2_6, "json");
+ }
+}
diff --git a/test/AsyncAPI.Saunter.Generator.Cli.Tests/AsyncAPI.Saunter.Generator.Cli.Tests.csproj b/test/AsyncAPI.Saunter.Generator.Cli.Tests/AsyncAPI.Saunter.Generator.Cli.Tests.csproj
index 355fdd5..3a3489a 100644
--- a/test/AsyncAPI.Saunter.Generator.Cli.Tests/AsyncAPI.Saunter.Generator.Cli.Tests.csproj
+++ b/test/AsyncAPI.Saunter.Generator.Cli.Tests/AsyncAPI.Saunter.Generator.Cli.Tests.csproj
@@ -8,6 +8,26 @@
true
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+ true
+ PreserveNewest
+
+
+
+
+
+
+
@@ -24,4 +44,10 @@
+
+
+ PreserveNewest
+
+
+
diff --git a/test/AsyncAPI.Saunter.Generator.Cli.Tests/DotnetCliToolTests.cs b/test/AsyncAPI.Saunter.Generator.Cli.Tests/DotnetCliToolTests.cs
index 97258c8..462b2f7 100644
--- a/test/AsyncAPI.Saunter.Generator.Cli.Tests/DotnetCliToolTests.cs
+++ b/test/AsyncAPI.Saunter.Generator.Cli.Tests/DotnetCliToolTests.cs
@@ -66,169 +66,12 @@ public void StreetlightsAPIExportSpecTest()
File.Exists("asyncapi.json").ShouldBeTrue("asyncapi.json");
var yml = File.ReadAllText("asyncapi.yml");
- yml.ShouldBe("""
- asyncapi: 2.6.0
- info:
- title: Streetlights API
- version: 1.0.0
- description: The Smartylighting Streetlights API allows you to remotely manage the city lights.
- license:
- name: Apache 2.0
- url: https://www.apache.org/licenses/LICENSE-2.0
- servers:
- mosquitto:
- url: test.mosquitto.org
- protocol: mqtt
- webapi:
- url: localhost:5000
- protocol: http
- defaultContentType: application/json
- channels:
- publish/light/measured:
- servers:
- - webapi
- publish:
- operationId: MeasureLight
- summary: Inform about environmental lighting conditions for a particular streetlight.
- tags:
- - name: Light
- message:
- $ref: '#/components/messages/lightMeasuredEvent'
- subscribe/light/measured:
- servers:
- - mosquitto
- subscribe:
- operationId: PublishLightMeasurement
- summary: Subscribe to environmental lighting conditions for a particular streetlight.
- tags:
- - name: Light
- message:
- payload:
- $ref: '#/components/schemas/lightMeasuredEvent'
- components:
- schemas:
- lightMeasuredEvent:
- type: object
- properties:
- id:
- type: integer
- format: int32
- description: Id of the streetlight.
- lumens:
- type: integer
- format: int32
- description: Light intensity measured in lumens.
- sentAt:
- type: string
- format: date-time
- description: Light intensity measured in lumens.
- additionalProperties: false
- messages:
- lightMeasuredEvent:
- payload:
- $ref: '#/components/schemas/lightMeasuredEvent'
- name: lightMeasuredEvent
- """, "yaml");
+ yml.ShouldBe(ExpectedSpecFiles.Yml_v2_6, "yaml");
var yaml = File.ReadAllText("asyncapi.yaml");
yaml.ShouldBe(yml, "yml");
var json = File.ReadAllText("asyncapi.json");
- json.ShouldBe("""
- {
- "asyncapi": "2.6.0",
- "info": {
- "title": "Streetlights API",
- "version": "1.0.0",
- "description": "The Smartylighting Streetlights API allows you to remotely manage the city lights.",
- "license": {
- "name": "Apache 2.0",
- "url": "https://www.apache.org/licenses/LICENSE-2.0"
- }
- },
- "servers": {
- "mosquitto": {
- "url": "test.mosquitto.org",
- "protocol": "mqtt"
- },
- "webapi": {
- "url": "localhost:5000",
- "protocol": "http"
- }
- },
- "defaultContentType": "application/json",
- "channels": {
- "publish/light/measured": {
- "servers": [
- "webapi"
- ],
- "publish": {
- "operationId": "MeasureLight",
- "summary": "Inform about environmental lighting conditions for a particular streetlight.",
- "tags": [
- {
- "name": "Light"
- }
- ],
- "message": {
- "$ref": "#/components/messages/lightMeasuredEvent"
- }
- }
- },
- "subscribe/light/measured": {
- "servers": [
- "mosquitto"
- ],
- "subscribe": {
- "operationId": "PublishLightMeasurement",
- "summary": "Subscribe to environmental lighting conditions for a particular streetlight.",
- "tags": [
- {
- "name": "Light"
- }
- ],
- "message": {
- "payload": {
- "$ref": "#/components/schemas/lightMeasuredEvent"
- }
- }
- }
- }
- },
- "components": {
- "schemas": {
- "lightMeasuredEvent": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer",
- "format": "int32",
- "description": "Id of the streetlight."
- },
- "lumens": {
- "type": "integer",
- "format": "int32",
- "description": "Light intensity measured in lumens."
- },
- "sentAt": {
- "type": "string",
- "format": "date-time",
- "description": "Light intensity measured in lumens."
- }
- },
- "additionalProperties": false
- }
- },
- "messages": {
- "lightMeasuredEvent": {
- "payload": {
- "$ref": "#/components/schemas/lightMeasuredEvent"
- },
- "name": "lightMeasuredEvent"
- }
- }
- }
- }
- """, "json");
+ json.ShouldBe(ExpectedSpecFiles.Json_v2_6, "json");
}
}
diff --git a/test/AsyncAPI.Saunter.Generator.Cli.Tests/Specs/ExpectedSpecFiles.cs b/test/AsyncAPI.Saunter.Generator.Cli.Tests/Specs/ExpectedSpecFiles.cs
new file mode 100644
index 0000000..aa6ed03
--- /dev/null
+++ b/test/AsyncAPI.Saunter.Generator.Cli.Tests/Specs/ExpectedSpecFiles.cs
@@ -0,0 +1,12 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace AsyncAPI.Saunter.Generator.Cli.Tests;
+
+public static class ExpectedSpecFiles
+{
+ public static string Json_v2_6 => File.ReadAllText("Specs/streetlights_v2.6.json");
+
+ public static string Yml_v2_6 => File.ReadAllText("Specs/streetlights_v2.6.yml");
+}
diff --git a/test/AsyncAPI.Saunter.Generator.Cli.Tests/Specs/streetlights_v2.6.json b/test/AsyncAPI.Saunter.Generator.Cli.Tests/Specs/streetlights_v2.6.json
new file mode 100644
index 0000000..8a429cb
--- /dev/null
+++ b/test/AsyncAPI.Saunter.Generator.Cli.Tests/Specs/streetlights_v2.6.json
@@ -0,0 +1,94 @@
+{
+ "asyncapi": "2.6.0",
+ "info": {
+ "title": "Streetlights API",
+ "version": "1.0.0",
+ "description": "The Smartylighting Streetlights API allows you to remotely manage the city lights.",
+ "license": {
+ "name": "Apache 2.0",
+ "url": "https://www.apache.org/licenses/LICENSE-2.0"
+ }
+ },
+ "servers": {
+ "mosquitto": {
+ "url": "test.mosquitto.org",
+ "protocol": "mqtt"
+ },
+ "webapi": {
+ "url": "localhost:5000",
+ "protocol": "http"
+ }
+ },
+ "defaultContentType": "application/json",
+ "channels": {
+ "publish/light/measured": {
+ "servers": [
+ "webapi"
+ ],
+ "publish": {
+ "operationId": "MeasureLight",
+ "summary": "Inform about environmental lighting conditions for a particular streetlight.",
+ "tags": [
+ {
+ "name": "Light"
+ }
+ ],
+ "message": {
+ "$ref": "#/components/messages/lightMeasuredEvent"
+ }
+ }
+ },
+ "subscribe/light/measured": {
+ "servers": [
+ "mosquitto"
+ ],
+ "subscribe": {
+ "operationId": "PublishLightMeasurement",
+ "summary": "Subscribe to environmental lighting conditions for a particular streetlight.",
+ "tags": [
+ {
+ "name": "Light"
+ }
+ ],
+ "message": {
+ "payload": {
+ "$ref": "#/components/schemas/lightMeasuredEvent"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "lightMeasuredEvent": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Id of the streetlight."
+ },
+ "lumens": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Light intensity measured in lumens."
+ },
+ "sentAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Light intensity measured in lumens."
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "messages": {
+ "lightMeasuredEvent": {
+ "payload": {
+ "$ref": "#/components/schemas/lightMeasuredEvent"
+ },
+ "name": "lightMeasuredEvent"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/AsyncAPI.Saunter.Generator.Cli.Tests/Specs/streetlights_v2.6.yml b/test/AsyncAPI.Saunter.Generator.Cli.Tests/Specs/streetlights_v2.6.yml
new file mode 100644
index 0000000..efccd7e
--- /dev/null
+++ b/test/AsyncAPI.Saunter.Generator.Cli.Tests/Specs/streetlights_v2.6.yml
@@ -0,0 +1,61 @@
+asyncapi: 2.6.0
+info:
+ title: Streetlights API
+ version: 1.0.0
+ description: The Smartylighting Streetlights API allows you to remotely manage the city lights.
+ license:
+ name: Apache 2.0
+ url: https://www.apache.org/licenses/LICENSE-2.0
+servers:
+ mosquitto:
+ url: test.mosquitto.org
+ protocol: mqtt
+ webapi:
+ url: localhost:5000
+ protocol: http
+defaultContentType: application/json
+channels:
+ publish/light/measured:
+ servers:
+ - webapi
+ publish:
+ operationId: MeasureLight
+ summary: Inform about environmental lighting conditions for a particular streetlight.
+ tags:
+ - name: Light
+ message:
+ $ref: '#/components/messages/lightMeasuredEvent'
+ subscribe/light/measured:
+ servers:
+ - mosquitto
+ subscribe:
+ operationId: PublishLightMeasurement
+ summary: Subscribe to environmental lighting conditions for a particular streetlight.
+ tags:
+ - name: Light
+ message:
+ payload:
+ $ref: '#/components/schemas/lightMeasuredEvent'
+components:
+ schemas:
+ lightMeasuredEvent:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int32
+ description: Id of the streetlight.
+ lumens:
+ type: integer
+ format: int32
+ description: Light intensity measured in lumens.
+ sentAt:
+ type: string
+ format: date-time
+ description: Light intensity measured in lumens.
+ additionalProperties: false
+ messages:
+ lightMeasuredEvent:
+ payload:
+ $ref: '#/components/schemas/lightMeasuredEvent'
+ name: lightMeasuredEvent
\ No newline at end of file