Skip to content

Commit

Permalink
Merge pull request #18 from ejball/events
Browse files Browse the repository at this point in the history
  • Loading branch information
ejball authored Jul 4, 2024
2 parents 4d0ac01 + 18e8066 commit d5fdab0
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>

<PropertyGroup>
<VersionPrefix>0.14.0</VersionPrefix>
<PackageValidationBaselineVersion>0.13.0</PackageValidationBaselineVersion>
<VersionPrefix>0.14.1</VersionPrefix>
<PackageValidationBaselineVersion>0.14.0</PackageValidationBaselineVersion>
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Facility.CodeGen.Console" Version="2.13.0" />
<PackageVersion Include="Facility.Definition" Version="2.13.0" />
<PackageVersion Include="Facility.CodeGen.Console" Version="2.14.0" />
<PackageVersion Include="Facility.Definition" Version="2.14.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="NUnit" Version="4.1.0" />
Expand Down
1 change: 1 addition & 0 deletions FacilityPython.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.github\workflows\build.yaml = .github\workflows\build.yaml
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
dotnet-tools.json = dotnet-tools.json
global.json = global.json
LICENSE = LICENSE
nuget.config = nuget.config
Expand Down
4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 0.14.1

* Ignore events for now.

## 0.14.0

* Add .NET 8 targets. Update dependencies.
Expand Down
9 changes: 9 additions & 0 deletions conformance/ConformanceApi.fsd
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,15 @@ service ConformanceApi
[http(from: body, type: "application/x-output")] content: bytes;
}

[http(method: GET)]
event fibonacci
{
count: int32!;
}:
{
value: int32!;
}

data Any
{
string: string;
Expand Down
5 changes: 3 additions & 2 deletions dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"isRoot": true,
"tools": {
"facilityconformance": {
"version": "2.22.0",
"version": "2.29.0",
"commands": [
"FacilityConformance"
]
],
"rollForward": false
}
}
}
11 changes: 11 additions & 0 deletions src/Facility.CodeGen.Python/PythonGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Text.RegularExpressions;
using Facility.Definition;
using Facility.Definition.CodeGen;
using Facility.Definition.Fsd;
using Facility.Definition.Http;

namespace Facility.CodeGen.Python
Expand All @@ -13,8 +14,18 @@ public sealed class PythonGenerator : CodeGenerator
/// <summary>
/// Generates Python.
/// </summary>
/// <param name="parser">The parser.</param>
/// <param name="settings">The settings.</param>
/// <returns>The number of updated files.</returns>
public static int GeneratePython(ServiceParser parser, PythonGeneratorSettings settings) =>
FileGenerator.GenerateFiles(parser, new PythonGenerator { GeneratorName = nameof(PythonGenerator) }, settings);

/// <summary>
/// Generates Python.
/// </summary>
/// <param name="settings">The settings.</param>
/// <returns>The number of updated files.</returns>
[Obsolete("Use the overload that takes a parser.")]
public static int GeneratePython(PythonGeneratorSettings settings) =>
FileGenerator.GenerateFiles(new PythonGenerator { GeneratorName = nameof(PythonGenerator) }, settings);

Expand Down
3 changes: 3 additions & 0 deletions src/fsdgenpython/FsdGenPythonApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Facility.CodeGen.Console;
using Facility.CodeGen.Python;
using Facility.Definition.CodeGen;
using Facility.Definition.Fsd;

namespace fsdgenpython
{
Expand All @@ -19,6 +20,8 @@ public static int Main(string[] args)

protected override IReadOnlyList<string> ExtraUsage => [];

protected override ServiceParser CreateParser() => new FsdParser(new FsdParserSettings { SupportsEvents = true });

protected override CodeGenerator CreateGenerator() => new PythonGenerator();

protected override FileGeneratorSettings CreateSettings(ArgsReader args) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public void GenerateExampleApiSuccess()
{
ServiceInfo service;
const string fileName = "Facility.CodeGen.Python.UnitTests.ConformanceApi.fsd";
var parser = new FsdParser();
var parser = new FsdParser(new FsdParserSettings { SupportsEvents = true });
var stream = GetType().GetTypeInfo().Assembly.GetManifestResourceStream(fileName);
Assert.That(stream, Is.Not.Null);
using (var reader = new StreamReader(stream!))
Expand Down

0 comments on commit d5fdab0

Please sign in to comment.