|
|
@ -9,13 +9,14 @@ using NJsonSchema; |
|
|
using NSwag; |
|
|
using NSwag; |
|
|
using NSwag.Generation; |
|
|
using NSwag.Generation; |
|
|
using NSwag.Generation.Processors.Contexts; |
|
|
using NSwag.Generation.Processors.Contexts; |
|
|
|
|
|
using Squidex.Domain.Apps.Core; |
|
|
using Squidex.Domain.Apps.Entities; |
|
|
using Squidex.Domain.Apps.Entities; |
|
|
using Squidex.Domain.Apps.Entities.Apps; |
|
|
using Squidex.Domain.Apps.Entities.Apps; |
|
|
using Squidex.Domain.Apps.Entities.Schemas; |
|
|
using Squidex.Domain.Apps.Entities.Schemas; |
|
|
using Squidex.Hosting; |
|
|
|
|
|
using Squidex.Infrastructure.Caching; |
|
|
using Squidex.Infrastructure.Caching; |
|
|
using Squidex.Properties; |
|
|
using Squidex.Properties; |
|
|
using Squidex.Shared; |
|
|
using Squidex.Shared; |
|
|
|
|
|
using IRequestUrlGenerator = Squidex.Hosting.IUrlGenerator; |
|
|
using SchemaDefType = Squidex.Domain.Apps.Core.Schemas.SchemaType; |
|
|
using SchemaDefType = Squidex.Domain.Apps.Core.Schemas.SchemaType; |
|
|
|
|
|
|
|
|
namespace Squidex.Areas.Api.Controllers.Contents.Generator |
|
|
namespace Squidex.Areas.Api.Controllers.Contents.Generator |
|
|
@ -23,16 +24,16 @@ namespace Squidex.Areas.Api.Controllers.Contents.Generator |
|
|
public sealed class SchemasOpenApiGenerator |
|
|
public sealed class SchemasOpenApiGenerator |
|
|
{ |
|
|
{ |
|
|
private readonly IAppProvider appProvider; |
|
|
private readonly IAppProvider appProvider; |
|
|
private readonly IUrlGenerator urlGenerator; |
|
|
|
|
|
private readonly OpenApiDocumentGeneratorSettings schemaSettings; |
|
|
private readonly OpenApiDocumentGeneratorSettings schemaSettings; |
|
|
private readonly OpenApiSchemaGenerator schemaGenerator; |
|
|
private readonly OpenApiSchemaGenerator schemaGenerator; |
|
|
|
|
|
private readonly IRequestUrlGenerator urlGenerator; |
|
|
private readonly IRequestCache requestCache; |
|
|
private readonly IRequestCache requestCache; |
|
|
|
|
|
|
|
|
public SchemasOpenApiGenerator( |
|
|
public SchemasOpenApiGenerator( |
|
|
IAppProvider appProvider, |
|
|
IAppProvider appProvider, |
|
|
IUrlGenerator urlGenerator, |
|
|
|
|
|
OpenApiDocumentGeneratorSettings schemaSettings, |
|
|
OpenApiDocumentGeneratorSettings schemaSettings, |
|
|
OpenApiSchemaGenerator schemaGenerator, |
|
|
OpenApiSchemaGenerator schemaGenerator, |
|
|
|
|
|
IRequestUrlGenerator urlGenerator, |
|
|
IRequestCache requestCache) |
|
|
IRequestCache requestCache) |
|
|
{ |
|
|
{ |
|
|
this.appProvider = appProvider; |
|
|
this.appProvider = appProvider; |
|
|
@ -123,7 +124,7 @@ namespace Squidex.Areas.Api.Controllers.Contents.Generator |
|
|
.RequirePermission(Permissions.AppContentsReadOwn) |
|
|
.RequirePermission(Permissions.AppContentsReadOwn) |
|
|
.Operation("GetVersioned") |
|
|
.Operation("GetVersioned") |
|
|
.OperationSummary("Get a [schema] content item by id and version.") |
|
|
.OperationSummary("Get a [schema] content item by id and version.") |
|
|
.HasPath("version", JsonObjectType.Number, "The version of the content item.") |
|
|
.HasPath("version", JsonObjectType.Number, FieldDescriptions.EntityVersion) |
|
|
.HasId() |
|
|
.HasId() |
|
|
.Responds(200, "Content item returned.", builder.ContentSchema); |
|
|
.Responds(200, "Content item returned.", builder.ContentSchema); |
|
|
|
|
|
|
|
|
@ -139,8 +140,8 @@ namespace Squidex.Areas.Api.Controllers.Contents.Generator |
|
|
.RequirePermission(Permissions.AppContentsCreate) |
|
|
.RequirePermission(Permissions.AppContentsCreate) |
|
|
.Operation("Create") |
|
|
.Operation("Create") |
|
|
.OperationSummary("Create a [schema] content item.") |
|
|
.OperationSummary("Create a [schema] content item.") |
|
|
.HasQuery("publish", JsonObjectType.Boolean, "True to automatically publish the content.") |
|
|
.HasQuery("publish", JsonObjectType.Boolean, FieldDescriptions.ContentRequestPublish) |
|
|
.HasQuery("id", JsonObjectType.String, "The optional custom content id.") |
|
|
.HasQuery("id", JsonObjectType.String, FieldDescriptions.ContentRequestOptionalId) |
|
|
.HasBody("data", builder.DataSchema, Resources.OpenApiSchemaBody) |
|
|
.HasBody("data", builder.DataSchema, Resources.OpenApiSchemaBody) |
|
|
.Responds(201, "Content item created", builder.ContentSchema) |
|
|
.Responds(201, "Content item created", builder.ContentSchema) |
|
|
.Responds(400, "Content data not valid."); |
|
|
.Responds(400, "Content data not valid."); |
|
|
@ -149,7 +150,8 @@ namespace Squidex.Areas.Api.Controllers.Contents.Generator |
|
|
.RequirePermission(Permissions.AppContentsUpsert) |
|
|
.RequirePermission(Permissions.AppContentsUpsert) |
|
|
.Operation("Upsert") |
|
|
.Operation("Upsert") |
|
|
.OperationSummary("Upsert a [schema] content item.") |
|
|
.OperationSummary("Upsert a [schema] content item.") |
|
|
.HasQuery("publish", JsonObjectType.Boolean, "True to automatically publish the content.") |
|
|
.HasQuery("patch", JsonObjectType.Boolean, FieldDescriptions.ContentRequestPatch) |
|
|
|
|
|
.HasQuery("publish", JsonObjectType.Boolean, FieldDescriptions.ContentRequestPublish) |
|
|
.HasId() |
|
|
.HasId() |
|
|
.HasBody("data", builder.DataSchema, Resources.OpenApiSchemaBody) |
|
|
.HasBody("data", builder.DataSchema, Resources.OpenApiSchemaBody) |
|
|
.Responds(200, "Content item created or updated.", builder.ContentSchema) |
|
|
.Responds(200, "Content item created or updated.", builder.ContentSchema) |
|
|
|