Skip to content

Commit

Permalink
Clean up old rest specification files (#319)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Aug 17, 2023
1 parent 26c0f71 commit 74bcaab
Show file tree
Hide file tree
Showing 158 changed files with 0 additions and 10,041 deletions.
1 change: 0 additions & 1 deletion src/ApiGenerator/ApiGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<PackageReference Include="System.Text.Encodings.Web" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="RestSpecification\Core" />
<EmbeddedResource Include="Views\**\*.cshtml" />
</ItemGroup>
</Project>
6 changes: 0 additions & 6 deletions src/ApiGenerator/Domain/Specification/ApiEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
using ApiGenerator.Domain.Code.HighLevel.Methods;
using ApiGenerator.Domain.Code.HighLevel.Requests;
using ApiGenerator.Domain.Code.LowLevel;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace ApiGenerator.Domain.Specification
{
Expand All @@ -52,18 +50,14 @@ public class ApiEndpoint
/// <summary> Computed Csharp identifier names </summary>
public CsharpNames CsharpNames { get; set; }

[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("stability")]
public Stability Stability { get; set; }

[JsonProperty("documentation")]
public Documentation OfficialDocumentationLink { get; set; }

public UrlInformation Url { get; set; }

public Body Body { get; set; }

[JsonProperty("methods")]
public IReadOnlyCollection<string> HttpMethods { get; set; }

public IEndpointOverrides Overrides { get; internal set; }
Expand Down
45 changes: 0 additions & 45 deletions src/ApiGenerator/Domain/Specification/Documentation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@
* under the License.
*/

using System;
using Newtonsoft.Json;

namespace ApiGenerator.Domain.Specification
{
[JsonConverter(typeof(DocumentationConverter))]
public class Documentation
{
public string Description { get; set; }
Expand All @@ -43,45 +39,4 @@ public string Url
set => _url = value?.Replace("http://", "https://");
}
}

public class DocumentationConverter : JsonConverter
{
public override bool CanWrite { get; } = false;

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) => throw new NotSupportedException();

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{

var documentation = new Documentation();

if (reader.TokenType == JsonToken.String)
{
documentation.Url = (string)reader.Value;
return documentation;
}

while (reader.Read())
{
if (reader.TokenType == JsonToken.EndObject)
break;

var prop = (string)reader.Value;
switch (prop)
{
case "url":
documentation.Url = reader.ReadAsString();
break;
case "description":
documentation.Description = reader.ReadAsString();
break;
default:
throw new Exception($"Property '{prop}' unexpected in documentation object");
}
}
return documentation;
}

public override bool CanConvert(Type objectType) => true;
}
}
18 changes: 0 additions & 18 deletions src/ApiGenerator/Domain/Specification/QueryParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
using System.Collections.Generic;
using System.Linq;
using ApiGenerator.Generator;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ApiGenerator.Domain.Specification
{
Expand Down Expand Up @@ -203,20 +201,4 @@ public class QueryParameterDeprecation

public string Description { get; set; }
}

internal class QueryParameterDeprecationConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) => throw new NotImplementedException();

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Boolean)
return new QueryParameterDeprecation();

var jObject = JObject.Load(reader);
return jObject.ToObject<QueryParameterDeprecation>(JsonSerializer.CreateDefault());
}

public override bool CanConvert(Type objectType) => typeof(QueryParameterDeprecation).IsAssignableFrom(objectType);
}
}
4 changes: 0 additions & 4 deletions src/ApiGenerator/Domain/Specification/UrlInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;

namespace ApiGenerator.Domain.Specification
{
Expand All @@ -39,13 +38,10 @@ public class UrlInformation
{
public IDictionary<string, QueryParameters> Params { get; set; } = new SortedDictionary<string, QueryParameters>();

[JsonProperty("paths")]
public IList<string> OriginalPaths { get; set; } = new List<string>();

[JsonProperty("parts")]
public IDictionary<string, UrlPart> OriginalParts { get; set; }

[JsonProperty("deprecated_paths")]
private IReadOnlyCollection<DeprecatedPath> DeprecatedPaths { get; set; }

private List<UrlPath> _paths;
Expand Down
31 changes: 0 additions & 31 deletions src/ApiGenerator/RestSpecification/Core/_common.json

This file was deleted.

107 changes: 0 additions & 107 deletions src/ApiGenerator/RestSpecification/Core/bulk.json

This file was deleted.

75 changes: 0 additions & 75 deletions src/ApiGenerator/RestSpecification/Core/cat.aliases.json

This file was deleted.

Loading

0 comments on commit 74bcaab

Please sign in to comment.