-
Notifications
You must be signed in to change notification settings - Fork 196
[Source Gen] Create JSON directly instead of using anonymous type #1191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pushing out initial prototype quickly for cold-start testing, but to do:
|
sdk/Sdk.Generators/FunctionMetadataProviderGenerator.Emitter.cs
Outdated
Show resolved
Hide resolved
sdk/Sdk.Generators/FunctionMetadataProviderGenerator.Emitter.cs
Outdated
Show resolved
Hide resolved
@@ -21,6 +21,6 @@ internal class GeneratorFunctionMetadata | |||
|
|||
public IDictionary<string, object> Properties { get; set; } = new Dictionary<string, object>(); | |||
|
|||
public IList<IDictionary<string, string>> RawBindings { get; set; } = new List<IDictionary<string, string>>(); // List of <propertyName, propertyValue> bindings. | |||
public IList<IDictionary<string, object>> RawBindings { get; set; } = new List<IDictionary<string, object>>(); // List of <propertyName, propertyValue> bindings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string
-> object
change is due to switching to JSON serialization. Previously, arrays were stored as a string that would be written right to the generated file, but now we need the actual array object.
</PropertyGroup> | ||
|
||
<Import Project="..\..\build\Common.props" /> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" PrivateAssets="all" GeneratePathProperty="true" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This package and the one below it are dependencies of System.Text.Json
- we have to include these explicitly.
test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/ExtensionsTests.cs
Outdated
Show resolved
Hide resolved
sdk/Sdk.Generators/FunctionMetadataProviderGenerator.Emitter.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great to see! Much simpler in the end I think.
<ItemGroup> | ||
<!-- Package the generator in the analyzer directory of the nuget package --> | ||
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> | ||
|
||
<None Include="$(PKGSystem_Text_Json)\lib\netstandard2.0\*.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see you are using this package, but where/why are the other two needed? Are they dependencies of STJ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes they're dependencies of STJ and they won't get loaded with STJ ... had to add each package associated with a "couldn't find file or assembly" until the generator built successfully.
/check-enforcer evaluate |
Issue describing the changes in this PR
resolves #1188
Pull request checklist
release_notes.md
Additional information
Additional PR information