lynMarkdigRenderTest13 1.0.0
dotnet add package lynMarkdigRenderTest13 --version 1.0.0
NuGet\Install-Package lynMarkdigRenderTest13 -Version 1.0.0
<PackageReference Include="lynMarkdigRenderTest13" Version="1.0.0" />
paket add lynMarkdigRenderTest13 --version 1.0.0
#r "nuget: lynMarkdigRenderTest13, 1.0.0"
// Install lynMarkdigRenderTest13 as a Cake Addin #addin nuget:?package=lynMarkdigRenderTest13&version=1.0.0 // Install lynMarkdigRenderTest13 as a Cake Tool #tool nuget:?package=lynMarkdigRenderTest13&version=1.0.0
a type that is either a Robot or a User
union Create = Robot | User
you can also define interfaces for things with common properties (if composition does not fit your needs)
### Compiler
To transform your schema into C# code, you can run the Coberec.CLI program. Use it as follows: `Coberec.CLI.exe input1.gql ... input43.gql --outDir ./GeneratedClasses [--config coberec.config.json] [--namespace MyProject.Model]`
The parameters are:
* `--config configFile.json`: Json file used for configuration of code generator, see config docs for more info. Supports most JSON5 features (unquoted identifiers, trailing commas, C-style comments).
* `--out outFile.cs`: Generated code goes into the specified file. You can use `-` to write to std out.
* `--outDir outDirectory`: Generated code goes into the specified directory. Usually, 1 class goes into 1 file (except for name conflict and nested classes).
* `--namespace MyNamespace`: Specifies C# namespace of the generated classes. The same option can be set in the configuration file, but this one has precedence.
* `[--input] inputFile.gql`: Add the specified input file into the schema.
* `--verbose`: Prints a bit more information sometimes.
* `--invertNonNullable`: Makes non-nullable types nullable and vice versa. It's useful hack for the case when almost everything is non-nullable as it's the default with this option.
To run the compiler before build of your project, simply put these lines into the .csproj file:
```xml
<Target Name="BuildCoberec" BeforeTargets="BeforeCompile" Inputs="schema/**" Outputs="GeneratedSchema/**.cs">
<Exec Command="dotnet ./path/to/Coberec.CLI.dll --config schema/config.json schema/**.gql --outDir GeneratedSchema --verbose" />
<ItemGroup>
<Compile Include="GeneratedSchema/**.cs" />
</ItemGroup>
</Target>
COBEREC Generator
This an experimental C# code generator that generates data classes from model written in GraphQL Schema language. It is a tool aiming at generating COrrect REadable and BEautiful Code, with priority on the correctness.
GraphQL Schema
COBEREC translates a domain model written in GraphQL Schema language into C# immutable classes, so you can declare your domain very easily without any boilerplate. As an intermediate representation, we use a simple representation of the schema, so you can also fairly easily consume it and create db schema, user interfaces or whatever yourself. Well, simply if you don't care about correctness in edge cases or if you already have a simple and robust backend...
CSharp generator
The C# code generator is based on the awesome ILSpy decompiler which makes sure that it produces quite nice looking code that always represents what was intended. C# is a very complex language and it would be very hard without using ILSpy's backend.
Usage
Schema
First, you need the schema. To define it, you can use the fundamental features of GraphQL Schema:
# declared a type
type User {
# non-nullable field id
id: ID!
firstName: String
lastName: String
photoUrl: Url
}
# declares custom scalar type that can be represented by a single string
scalar Url
# another type
type Robot {
id: ID!
name: String
}
# a type that is either a Robot or a User
union Create = Robot | User
# you can also define interfaces for things with common properties (if composition does not fit your needs)
Compiler
To transform your schema into C# code, you can run the Coberec.CLI program. Use it as follows: Coberec.CLI.exe input1.gql ... input43.gql --outDir ./GeneratedClasses [--config coberec.config.json] [--namespace MyProject.Model]
The parameters are:
--config configFile.json
: Json file used for configuration of code generator, see config docs for more info. Supports most JSON5 features (unquoted identifiers, trailing commas, C-style comments).--out outFile.cs
: Generated code goes into the specified file. You can use-
to write to std out.--outDir outDirectory
: Generated code goes into the specified directory. Usually, 1 class goes into 1 file (except for name conflict and nested classes).--namespace MyNamespace
: Specifies C# namespace of the generated classes. The same option can be set in the configuration file, but this one has precedence.[--input] inputFile.gql
: Add the specified input file into the schema.--verbose
: Prints a bit more information sometimes.--invertNonNullable
: Makes non-nullable types nullable and vice versa. It's useful hack for the case when almost everything is non-nullable as it's the default with this option.
To run the compiler before build of your project, simply put these lines into the .csproj file:
<Target Name="BuildCoberec" BeforeTargets="BeforeCompile" Inputs="schema/**" Outputs="GeneratedSchema/**.cs">
<Exec Command="dotnet ./path/to/Coberec.CLI.dll --config schema/config.json schema/**.gql --outDir GeneratedSchema --verbose" />
<ItemGroup>
<Compile Include="GeneratedSchema/**.cs" />
</ItemGroup>
</Target>
Configuration
The configuration is basically a JSON file with the serialized EmitSettings class inside. The fundamental configuration options are:
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 0 | 11/24/2020 |