Browse Source

Another warning removed.

pull/362/head
Sebastian Stehle 7 years ago
parent
commit
73db57426a
  1. 7
      src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonSchemaExtensions.cs
  2. 7
      src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs
  3. 8
      src/Squidex/Areas/Api/Controllers/Contents/Generator/SchemaSwaggerGenerator.cs
  4. 2
      tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/TextIndexerGrainTests.cs

7
src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonSchemaExtensions.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license. // All rights reserved. Licensed under the MIT license.
// ========================================================================== // ==========================================================================
using System;
using NJsonSchema; using NJsonSchema;
using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.Schemas;
using Squidex.Infrastructure; using Squidex.Infrastructure;
@ -14,7 +13,7 @@ namespace Squidex.Domain.Apps.Core.GenerateJsonSchema
{ {
public static class JsonSchemaExtensions public static class JsonSchemaExtensions
{ {
public static JsonSchema4 BuildJsonSchema(this Schema schema, PartitionResolver partitionResolver, Func<string, JsonSchema4, JsonSchema4> schemaResolver) public static JsonSchema4 BuildJsonSchema(this Schema schema, PartitionResolver partitionResolver, SchemaResolver schemaResolver)
{ {
Guard.NotNull(schemaResolver, nameof(schemaResolver)); Guard.NotNull(schemaResolver, nameof(schemaResolver));
Guard.NotNull(partitionResolver, nameof(partitionResolver)); Guard.NotNull(partitionResolver, nameof(partitionResolver));
@ -27,9 +26,9 @@ namespace Squidex.Domain.Apps.Core.GenerateJsonSchema
foreach (var field in schema.Fields.ForApi()) foreach (var field in schema.Fields.ForApi())
{ {
var partitionObject = Builder.Object(); var partitionObject = Builder.Object();
var partition = partitionResolver(field.Partitioning); var partitionSet = partitionResolver(field.Partitioning);
foreach (var partitionItem in partition) foreach (var partitionItem in partitionSet)
{ {
var partitionItemProperty = field.Accept(jsonTypeVisitor); var partitionItemProperty = field.Accept(jsonTypeVisitor);

7
src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs

@ -5,18 +5,19 @@
// All rights reserved. Licensed under the MIT license. // All rights reserved. Licensed under the MIT license.
// ========================================================================== // ==========================================================================
using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using NJsonSchema; using NJsonSchema;
using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.Schemas;
namespace Squidex.Domain.Apps.Core.GenerateJsonSchema namespace Squidex.Domain.Apps.Core.GenerateJsonSchema
{ {
public delegate JsonSchema4 SchemaResolver(string name, JsonSchema4 schema);
public sealed class JsonTypeVisitor : IFieldVisitor<JsonProperty> public sealed class JsonTypeVisitor : IFieldVisitor<JsonProperty>
{ {
private readonly Func<string, JsonSchema4, JsonSchema4> schemaResolver; private readonly SchemaResolver schemaResolver;
public JsonTypeVisitor(Func<string, JsonSchema4, JsonSchema4> schemaResolver) public JsonTypeVisitor(SchemaResolver schemaResolver)
{ {
this.schemaResolver = schemaResolver; this.schemaResolver = schemaResolver;
} }

8
src/Squidex/Areas/Api/Controllers/Contents/Generator/SchemaSwaggerGenerator.cs

@ -40,7 +40,13 @@ namespace Squidex.Areas.Api.Controllers.Contents.Generator
SchemaQueryDescription = NSwagHelper.LoadDocs("schemaquery"); SchemaQueryDescription = NSwagHelper.LoadDocs("schemaquery");
} }
public SchemaSwaggerGenerator(SwaggerDocument document, string appName, string appPath, Schema schema, Func<string, JsonSchema4, JsonSchema4> schemaResolver, PartitionResolver partitionResolver) public SchemaSwaggerGenerator(
SwaggerDocument document,
string appName,
string appPath,
Schema schema,
SchemaResolver schemaResolver,
PartitionResolver partitionResolver)
{ {
this.document = document; this.document = document;

2
tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/TextIndexerGrainTests.cs

@ -115,7 +115,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text
} }
[Fact] [Fact]
public async Task Should_simulate_content_reversion() public async Task Should_simulate_content_reversion()
{ {
await AddInvariantContent("Hello", "World", false); await AddInvariantContent("Hello", "World", false);

Loading…
Cancel
Save