Skip to content

Commit

Permalink
Merge pull request #61 from sisgha/dev-gabriel
Browse files Browse the repository at this point in the history
chore: core and integrations folder
  • Loading branch information
guesant authored May 9, 2024
2 parents 2afd7cb + e5076b4 commit eb9670e
Show file tree
Hide file tree
Showing 115 changed files with 75 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci-js-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
- development
paths:
- "javascript/sisgea-spec/**/*"
- "core/**/*"
- .github/workflows/ci-js-spec.yml
workflow_dispatch:

Expand All @@ -16,7 +16,7 @@ concurrency:

defaults:
run:
working-directory: javascript/sisgea-spec
working-directory: core

permissions:
contents: read
Expand All @@ -38,7 +38,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: ./javascript/sisgea-spec/package-lock.json
cache-dependency-path: ./core/package-lock.json
- run: npm ci
- run: npm run build --if-present
- run: npm run test --if-present
Expand All @@ -61,7 +61,7 @@ jobs:
with:
node-version: 22.x
cache: "npm"
cache-dependency-path: ./javascript/sisgea-spec/package-lock.json
cache-dependency-path: ./core/package-lock.json
- run: npm ci
- run: npm run build

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ generate-json-schema:
-u node \
-it $$(docker build -q .devops) \
typescript-json-schema \
javascript/sisgea-spec/tsconfig.build.json \* \
-o generated/json-schema/v1/sisgea.schema.json \
core/tsconfig.build.json \* \
-o integrations/json-schema/v1/sisgea.schema.json \
--refs \
--noExtraProps \
--required \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion javascript/sisgea-spec/README.md → core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {} from '@sisgea/spec';

```sh
git clone https://github.com/sisgha/spec.git
cd spec/javascript/sisgea-spec
cd spec
```

<!-- -->
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions integrations/dotnet/GeneratorTool/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bin
obj
Dockerfile
.dockerignore
Makefile
15 changes: 15 additions & 0 deletions integrations/dotnet/GeneratorTool/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /App

# Copy everything
COPY . ./
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/runtime:8.0
WORKDIR /App
COPY --from=build-env /App/out .
ENTRYPOINT ["dotnet", "GeneratorTool.dll"]
14 changes: 14 additions & 0 deletions integrations/dotnet/GeneratorTool/GeneratorTool.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NJsonSchema.CodeGeneration.CSharp" Version="11.0.0" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions integrations/dotnet/GeneratorTool/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

build:
docker build -t "sisgea/dotnet-generator-tool" .
31 changes: 31 additions & 0 deletions integrations/dotnet/GeneratorTool/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using NJsonSchema.CodeGeneration.CSharp;
using JsonSchema = NJsonSchema.JsonSchema;

Console.WriteLine("@sisgea/spec - dotnet generator tool")
;

var inputPath = Environment.GetEnvironmentVariable("SPEC_JSON_SCHEMA");

if (!File.Exists(inputPath))
{
throw new Exception("File SPEC_JSON_SCHEMA not found");
}

var outputPath = Environment.GetEnvironmentVariable("SPEC_CHARP_OUTPUT");

if (outputPath == null || outputPath.Length == 0)
{
throw new Exception("Please provide SPEC_CHARP_OUTPUT.");
}


string json = File.ReadAllText(inputPath);
var schemaFromFile = JsonSchema.FromSampleJson(json);
var classGenerator = new CSharpGenerator(schemaFromFile, new CSharpGeneratorSettings
{
ClassStyle = CSharpClassStyle.Poco,
});


var codeFile = classGenerator.GenerateFile();
File.WriteAllText(outputPath, codeFile);
File renamed without changes.

0 comments on commit eb9670e

Please sign in to comment.