Skip to content

Commit

Permalink
[Backport 1.x] Code generation updates (#755)
Browse files Browse the repository at this point in the history
* Implement the `cat.pit_segments` and `cat.segment_replication` operations (#527)

* Implement `cat.pit_segments` and `cat.all_pit_segments`

Signed-off-by: Thomas Farr <[email protected]>

Allow body on get/head

Signed-off-by: Thomas Farr <[email protected]>

* Implement `cat.segment_replication`

Signed-off-by: Thomas Farr <[email protected]>

* Add changelog entry

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
(cherry picked from commit c3deb70)

* Update API generator to use new OpenAPI specification (#609)

* Update RestSpecDownloader

Signed-off-by: Thomas Farr <[email protected]>

* Improve Enum formatting

Signed-off-by: Thomas Farr <[email protected]>

* Patch request body references

Signed-off-by: Thomas Farr <[email protected]>

* Description changes

Signed-off-by: Thomas Farr <[email protected]>

* Improve type mapping

Signed-off-by: Thomas Farr <[email protected]>

* Correct component and composable template APIs which do not actually accept comma-separated lists.

Signed-off-by: Thomas Farr <[email protected]>

* Unify enums `Health` & `WaitForStatus` to `HealthStatus`

Signed-off-by: Thomas Farr <[email protected]>

* Change `NodeNames` & `NodeIds` from `string` to `string[]`

Signed-off-by: Thomas Farr <[email protected]>

* Rename `GroupBy` enum to `TasksGroupBy`

Signed-off-by: Thomas Farr <[email protected]>

* Correct `Level` params

Signed-off-by: Thomas Farr <[email protected]>

* Rename `SampleType` enum to `NodesSampleType`

Signed-off-by: Thomas Farr <[email protected]>

* Remove `QueryString` suffixing

Signed-off-by: Thomas Farr <[email protected]>

* Improve enum generation

Signed-off-by: Thomas Farr <[email protected]>

* Re-generate enums

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
(cherry picked from commit 553f7d1)

* Bump YamlDotNet from 15.1.2 to 15.1.6 (#663)

* Bump YamlDotNet from 15.1.2 to 15.1.6

Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 15.1.2 to 15.1.6.
- [Release notes](https://github.com/aaubry/YamlDotNet/releases)
- [Commits](aaubry/YamlDotNet@v15.1.2...v15.1.6)

Signed-off-by: Thomas Farr <[email protected]>

---
updated-dependencies:
- dependency-name: YamlDotNet
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update changelog

Signed-off-by: dependabot[bot] <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 26a619c)

* Updated location of the API spec. (#671)

Signed-off-by: dblock <[email protected]>
(cherry picked from commit 645fa9e)

* Bump NSwag.Core from 14.0.7 to 14.0.8 (#678)

* Bump NSwag.Core from 14.0.7 to 14.0.8

Bumps [NSwag.Core](https://github.com/RicoSuter/NSwag) from 14.0.7 to 14.0.8.
- [Release notes](https://github.com/RicoSuter/NSwag/releases)
- [Changelog](https://github.com/RicoSuter/NSwag/blob/master/CHANGELOG.md)
- [Commits](RicoSuter/NSwag@v14.0.7...v14.0.8)

Signed-off-by: Thomas Farr <[email protected]>

---
updated-dependencies:
- dependency-name: NSwag.Core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update changelog

Signed-off-by: dependabot[bot] <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 74668a9)

* Bump YamlDotNet from 15.1.6 to 15.3.0 (#677)

* Bump YamlDotNet from 15.1.6 to 15.3.0

Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 15.1.6 to 15.3.0.
- [Release notes](https://github.com/aaubry/YamlDotNet/releases)
- [Commits](aaubry/YamlDotNet@v15.1.6...v15.3.0)

Signed-off-by: Thomas Farr <[email protected]>
---
updated-dependencies:
- dependency-name: YamlDotNet
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update changelog

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Thomas Farr <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Thomas Farr <[email protected]>
(cherry picked from commit efbae03)

* Re-generate against latest OpenAPI specification (#713)

* Re-generate against latest OpenAPI specification

Signed-off-by: Thomas Farr <[email protected]>

* Update tests

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
(cherry picked from commit 275203b)

* Bump YamlDotNet from 15.3.0 to 16.0.0 (#721)

* Bump YamlDotNet from 15.3.0 to 16.0.0

Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 15.3.0 to 16.0.0.
- [Release notes](https://github.com/aaubry/YamlDotNet/releases)
- [Commits](aaubry/YamlDotNet@v15.3.0...v16.0.0)

Signed-off-by: Thomas Farr <[email protected]>
---
updated-dependencies:
- dependency-name: YamlDotNet
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update changelog

Signed-off-by: dependabot[bot] <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 81c9937)

* Re-generate client code using latest OpenSearch API specification (2024-07-22) (#720)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Xtansia <[email protected]>
(cherry picked from commit e0fbd07)

* Bump NSwag.Core from 14.0.8 to 14.1.0 (#731)

* Bump NSwag.Core from 14.0.8 to 14.1.0

Bumps [NSwag.Core](https://github.com/RicoSuter/NSwag) from 14.0.8 to 14.1.0.
- [Release notes](https://github.com/RicoSuter/NSwag/releases)
- [Changelog](https://github.com/RicoSuter/NSwag/blob/master/CHANGELOG.md)
- [Commits](RicoSuter/NSwag@v14.0.8...v14.1.0)

Signed-off-by: Thomas Farr <[email protected]>
---
updated-dependencies:
- dependency-name: NSwag.Core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update changelog

Signed-off-by: dependabot[bot] <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
(cherry picked from commit fbfb823)

* Add support for indices.stats (#753)

* Add support for indices.stats

Signed-off-by: Thomas Farr <[email protected]>

* Add changelog entry

Signed-off-by: Thomas Farr <[email protected]>

* Fix tests

Signed-off-by: Thomas Farr <[email protected]>

* Fix another test

Signed-off-by: Thomas Farr <[email protected]>

* Fix more tests

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
(cherry picked from commit 43ba0de)

---------

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Aug 17, 2024
1 parent 39df056 commit 2b4a961
Show file tree
Hide file tree
Showing 80 changed files with 52,774 additions and 34,127 deletions.
20 changes: 4 additions & 16 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,19 @@ root=true
[*]
charset = utf-8
end_of_line = lf
indent_style = tab
indent_size = 4
insert_final_newline=true

[*.cs]
trim_trailing_whitespace=true

[*.cshtml]
indent_style = tab
indent_size = 4

[*.{fs,fsx}]
indent_style = space
indent_size = 4
insert_final_newline=true

[*.yml]
indent_style = space
indent_size = 2

[*.{md,markdown,json,js,csproj,fsproj,targets,targets,props}]
indent_style = space
[*.{md,markdown,json,js,csproj,fsproj,targets,props}]
indent_size = 2

# Dotnet code style settings:
[*.{cs,vb}]
trim_trailing_whitespace = true

# ---
# naming conventions https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions
Expand Down Expand Up @@ -171,7 +159,7 @@ csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
# just a suggestion do to our JSON tests that use anonymous types to
# just a suggestion do to our JSON tests that use anonymous types to
# represent json quite a bit (makes copy paste easier).
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
restore-keys: |
${{ runner.os }}-nuget-
- run: "./build.sh integrate ${{ matrix.version }} readonly,writable random:test_only_one --report"
- run: "./build.sh integrate ${{ matrix.version }} readonly,replicatedreadonly,writable random:test_only_one --report"
name: Integration Tests
working-directory: client

Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
knn_plugin: true
plugins_output_directory: ${{ env.OPENSEARCH_PLUGINS_DIRECTORY }}

- run: "./build.sh integrate $OPENSEARCH_VERSION readonly,writable random:test_only_one --report"
- run: "./build.sh integrate $OPENSEARCH_VERSION readonly,replicatedreadonly,writable random:test_only_one --report"
name: Integration Tests
working-directory: client
env:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]
### Added
- Added support for the `Cat.PitSegments` and `Cat.SegmentReplication` APIs ([#527](https://github.com/opensearch-project/opensearch-net/pull/527))
- Added support for `MinScore` on `ScriptScoreQuery` ([#624](https://github.com/opensearch-project/opensearch-net/pull/624))
- Added support for serializing the `DateOnly` and `TimeOnly` types ([#734](https://github.com/opensearch-project/opensearch-net/pull/734))
- Added support for the `Ext` parameter on `SearchRequest` ([#738](https://github.com/opensearch-project/opensearch-net/pull/738))
- Added support for the `Indices.Stats` API ([#753](https://github.com/opensearch-project/opensearch-net/pull/753))

### Dependencies
- Bumps `AWSSDK.Core` from 3.7.204.12 to 3.7.400.4
Expand All @@ -21,6 +23,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Bumps `Octokit` from 11.0.0 to 13.0.1
- Bumps `System.Reactive` from 6.0.0 to 6.0.1
- Bumps `Argu` from 6.2.3 to 6.2.4
- Bumps `YamlDotNet` from 15.1.2 to 16.0.0
- Bumps `NSwag.Core` from 14.0.7 to 14.1.0
- Bumps `System.Text.Json` from 8.0.3 to 8.0.4
- Bumps `JetBrains.Annotations` from 2023.3.0 to 2024.2.0
- Bumps `JunitXml.TestLogger` from 3.1.12 to 4.0.254
Expand Down
7 changes: 4 additions & 3 deletions abstractions/src/OpenSearch.OpenSearch.Managed/ClusterBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ public IDisposable Start(IConsoleLineHandler writer, TimeSpan waitForStarted)
OnBeforeStart();

var subscriptions = new Subscriptions();
foreach (var node in Nodes) subscriptions.Add(node.SubscribeLines(writer));

var waitHandles = Nodes.Select(w => w.StartedHandle).ToArray();
if (!WaitHandle.WaitAll(waitHandles, waitForStarted))
foreach (var node in Nodes)
{
subscriptions.Add(node.SubscribeLines(writer));
if (node.WaitForStarted(waitForStarted)) continue;

var nodeExceptions = Nodes.Select(n => n.LastSeenException).Where(e => e != null).ToList();
writer?.WriteError(
$"{{{GetType().Name}.{nameof(Start)}}} cluster did not start after {waitForStarted}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ private static StartArguments StartArgs(NodeConfiguration config)

private static Dictionary<string, string> EnvVars(NodeConfiguration config)
{
var environmentVariables = new Dictionary<string, string> { { "OPENSEARCH_JAVA_OPTS", "-Xms1g -Xmx1g" } };
var javaOpts = new List<string> { "-Xms1g", "-Xmx1g" };

var environmentVariables = new Dictionary<string, string> { { "OPENSEARCH_JAVA_OPTS", string.Join(" ", javaOpts) } };

if (!string.IsNullOrWhiteSpace(config.FileSystem.ConfigPath))
environmentVariables.Add(config.FileSystem.ConfigEnvironmentVariableName, config.FileSystem.ConfigPath);

Expand Down
6 changes: 4 additions & 2 deletions build/scripts/scripts.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@
<Content Include="..\..\.github\license-header-fs.txt"><Link>license-header-fs.txt</Link></Content>
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="8.0.301" />

<PackageReference Include="Bullseye" Version="5.0.0" />
<ProjectReference Include="$(SolutionRoot)\abstractions\src\OpenSearch.OpenSearch.Managed\OpenSearch.OpenSearch.Managed.csproj" />

<PackageReference Include="Fake.Core.Environment" Version="6.1.0" />
<PackageReference Include="Fake.Core.SemVer" Version="6.1.0" />
<PackageReference Include="Fake.IO.FileSystem" Version="6.1.0" />
<PackageReference Include="Fake.IO.Zip" Version="6.1.0" />
<PackageReference Include="Fake.Tools.Git" Version="5.23.1" />

<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />

<PackageReference Include="Octokit" Version="13.0.1" />
Expand Down
5 changes: 3 additions & 2 deletions src/ApiGenerator/ApiGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>

<NoWarn>CS1591;NU1701</NoWarn>
<PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CSharpier.Core" Version="0.28.2" />
<PackageReference Include="Glob" Version="1.1.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NSwag.Core.Yaml" Version="14.0.7" />
<PackageReference Include="NSwag.Core" Version="14.1.0" />
<PackageReference Include="YamlDotNet" Version="16.0.0" />
<PackageReference Include="SemanticVersioning" Version="2.0.2" />
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
Expand Down
6 changes: 4 additions & 2 deletions src/ApiGenerator/Configuration/CodeConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ public static class CodeConfiguration
{
new("{create,delete}_pit"),
new("{delete,get}_all_pits"),

new("cat.{all_pit,pit}_segments"),
new("cat.segment_replication"),
new("cluster.{delete,exists,get,put}_component_template"),
new("indices.{delete,exists,get,put}_index_template")
new("indices.{delete,exists,get,put}_index_template"),
new("indices.stats")
};

public static bool IncludeOperation(string name) => OperationsToInclude.Any(g => g.IsMatch(name));
Expand Down
50 changes: 24 additions & 26 deletions src/ApiGenerator/Configuration/GeneratorLocations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,44 +31,42 @@

namespace ApiGenerator.Configuration
{
public static class GeneratorLocations
{
// @formatter:off — disable formatter after this line
public static string OpenApiSpecFile { get; } = $@"{Root}OpenSearch.openapi.json";
public static class GeneratorLocations
{
public static string OpenApiSpecFile { get; } = $"{Root}opensearch-openapi.yaml";

public static string OpenSearchNetFolder { get; } = $@"{Root}../../src/OpenSearch.Net/";
public static string OpenSearchNetFolder { get; } = $"{Root}../../src/OpenSearch.Net/";

public static string OpenSearchClientFolder { get; } = $@"{Root}../../src/OpenSearch.Client/";
public static string OpenSearchClientFolder { get; } = $"{Root}../../src/OpenSearch.Client/";

public static string LowLevelGeneratedFolder { get; } = $"{OpenSearchNetFolder}_Generated/";

public static string HighLevelGeneratedFolder { get; } = $"{OpenSearchClientFolder}_Generated/";

// @formatter:on — enable formatter after this line
public static string HighLevel(params string[] paths) => HighLevelGeneratedFolder + string.Join("/", paths);

public static string HighLevel(params string[] paths) => HighLevelGeneratedFolder + string.Join("/", paths);
public static string LowLevel(params string[] paths) => LowLevelGeneratedFolder + string.Join("/", paths);
public static string LowLevel(params string[] paths) => LowLevelGeneratedFolder + string.Join("/", paths);

public static readonly Assembly Assembly = typeof(Generator.ApiGenerator).Assembly;
public static readonly Assembly Assembly = typeof(Generator.ApiGenerator).Assembly;

private static string _root;
public static string Root
{
get
{
if (_root != null) return _root;
private static string _root;

var directoryInfo = new DirectoryInfo(Directory.GetCurrentDirectory());
public static string Root
{
get
{
if (_root != null) return _root;

var dotnetRun =
directoryInfo.Name == "ApiGenerator" &&
directoryInfo.Parent != null &&
directoryInfo.Parent.Name == "src";
var directoryInfo = new DirectoryInfo(Directory.GetCurrentDirectory());

_root = dotnetRun ? "" : @"../../../";
return _root;
}
}
var dotnetRun =
directoryInfo.Name == "ApiGenerator" &&
directoryInfo.Parent != null &&
directoryInfo.Parent.Name == "src";

}
_root = dotnetRun ? "" : "../../../";
return _root;
}
}
}
}

This file was deleted.

8 changes: 4 additions & 4 deletions src/ApiGenerator/Configuration/Overrides/GlobalOverrides.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public class GlobalOverrides : EndpointOverridesBase

private GlobalOverrides() { }

public IDictionary<string, Dictionary<string, string>> ObsoleteEnumMembers { get; set; } = new Dictionary<string, Dictionary<string, string>>()
{
{ "VersionType", new Dictionary<string, string>() { { "force", "Force is no longer accepted by the server as of 7.5.0 and will result in an error when used" } } }
};
public IDictionary<string, string> RenameEnums { get; } = new Dictionary<string, string>
{
{ "ExpandWildcard", "ExpandWildcards" }
};

public override IDictionary<string, string> ObsoleteQueryStringParams { get; set; } = new Dictionary<string, string>
{
Expand Down
12 changes: 1 addition & 11 deletions src/ApiGenerator/Domain/ApiRequestParametersPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,7 @@ private static string CreateCSharpName(string queryStringKey, string endpointNam
if (queryStringKey == "format" && endpointName == "text_structure.find_structure")
return "TextStructureFindStructureFormat";

var cased = queryStringKey.ToPascalCase();
switch (cased)
{
case "Type":
case "Index":
case "Source":
case "Script":
return cased + "QueryString";
default:
return cased;
}
return queryStringKey.ToPascalCase();
}

private static IList<string> CreateSkipList(IEndpointOverrides local, ICollection<string> declaredKeys) =>
Expand Down
9 changes: 9 additions & 0 deletions src/ApiGenerator/Domain/Code/CsharpNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using System.Collections.Generic;
using System.Linq;
using ApiGenerator.Configuration;
using ApiGenerator.Configuration.Overrides;
using ApiGenerator.Generator;

namespace ApiGenerator.Domain.Code
Expand Down Expand Up @@ -103,6 +104,7 @@ public string ResponseName
public const string LowLevelClientNamespacePrefix = "LowLevel";
public const string HighLevelClientNamespacePrefix = "";
public const string ClientNamespaceSuffix = "Namespace";

private static string CreateCSharpNamespace(string endpointNamespace)
{
switch (endpointNamespace)
Expand Down Expand Up @@ -203,5 +205,12 @@ public string GenericOrNonGenericResponseName
: RequestName;

public bool CustomResponseBuilderPerRequestOverride(out string call) => CodeConfiguration.ResponseBuilderInClientCalls.TryGetValue(RequestName, out call);

public static string GetEnumName(string schemaKey)
{
var enumName = schemaKey.Replace("_common", "").SplitPascalCase().ToPascalCase();
if (GlobalOverrides.Instance.RenameEnums.TryGetValue(enumName, out var renamed)) enumName = renamed;
return enumName;
}
}
}
45 changes: 2 additions & 43 deletions src/ApiGenerator/Domain/RestApiSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace ApiGenerator.Domain
public class EnumDescription
{
public string Name { get; set; }
public bool IsFlag { get; set; }
public IEnumerable<string> Options { get; set; }
}

Expand All @@ -55,48 +56,6 @@ public class RestApiSpec
.GroupBy(e => e.CsharpNames.Namespace)
.ToImmutableSortedDictionary(kv => kv.Key, kv => kv.ToList().AsReadOnly());


private IEnumerable<EnumDescription> _enumDescriptions;
public IEnumerable<EnumDescription> EnumsInTheSpec
{
get
{
if (_enumDescriptions != null) return _enumDescriptions;

var urlParameterEnums = Endpoints
.Values
.SelectMany(e => e.Url.Params.Values)
.Where(p => !p.Skip && p.Options != null && p.Options.Any())
.Select(p => new EnumDescription
{
Name = p.ClsName,
Options = p.Options
})
.ToList();

var urlPartEnums = Endpoints
.Values
.SelectMany(e => e.Url.Parts, (e, part) => new { e, part })
.Where(p => p.part.Options != null && p.part.Options.Any())
.Select(p =>
{
var ns = p.e.CsharpNames.Namespace;
var m = p.e.CsharpNames.MethodName;
return new EnumDescription
{
Name = (!m.StartsWith(ns) ? ns : string.Empty) + m + p.part.Name.ToPascalCase(),
Options = p.part.Options
};
}).
ToList();

_enumDescriptions = urlPartEnums
.Concat(urlParameterEnums)
.DistinctBy(e => e.Name)
.ToList();

return _enumDescriptions;
}
}
public ImmutableList<EnumDescription> EnumsInTheSpec { get; set; }
}
}
Loading

0 comments on commit 2b4a961

Please sign in to comment.