Skip to content

Commit

Permalink
Fix package name.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Oct 18, 2023
1 parent 751f500 commit ca18022
Show file tree
Hide file tree
Showing 3 changed files with 1,271 additions and 1,174 deletions.
10 changes: 7 additions & 3 deletions csharp/Squidex.ClientLibrary/CodeGeneration/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,26 @@ public static async Task Main()
{
var document = await OpenApiDocument.FromUrlAsync("https://localhost:5001/api/swagger/v1/swagger.json");

var rootFolder = Environment.GetEnvironmentVariable("SDKS_ROOT_FOLDER")!;

SchemaCleaner.AddExtensions(document);

// We write a more complete schema for fern code generation.
File.WriteAllText(@"..\..\..\..\..\..\..\sdk-fern\fern\api\openapi\openapi.json", document.ToJson().UseCloudUrl());
File.WriteAllText(Path.Combine(rootFolder, "sdk-php/openapi.json"), document.ToJson().UseCloudUrl());
File.WriteAllText(Path.Combine(rootFolder, "sdk-fern/fern/openapi/openapi.json"), document.ToJson().UseCloudUrl());
File.WriteAllText(Path.Combine(rootFolder, "sdk-fern/other-generators/openapi.json"), document.ToJson().UseCloudUrl());

// This cleanup is only needed for .NET.
SchemaCleaner.RemoveAppName(document);

// We also need a version without app name.
File.WriteAllText(@"..\..\..\..\..\..\..\sdk-fern\fern\api\openapi\openapi-noapp.json", document.ToJson().UseCloudUrl());
File.WriteAllText(Path.Combine(rootFolder, "sdk-fern/other-generators/openapi-noapp.json"), document.ToJson().UseCloudUrl());

SchemaCleaner.RemoveUnusedSchemas(document);

var sourceCode = GenerateCode(document);

File.WriteAllText(@"..\..\..\..\Squidex.ClientLibrary\Generated.cs", sourceCode);
File.WriteAllText(Path.Combine(rootFolder, "samples/csharp/Squidex.ClientLibrary/Squidex.ClientLibrary/Generated.cs"), sourceCode);
}

private static string GenerateCode(OpenApiDocument document)
Expand Down
Loading

0 comments on commit ca18022

Please sign in to comment.