Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PP9-13674: Regenerate SDK for schema protection options #564

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -1393,6 +1393,7 @@ public static PictureparkBusinessException FromJson(string data)
[JsonInheritanceAttribute("LayerAssignmentInvalidException", typeof(LayerAssignmentInvalidException))]
[JsonInheritanceAttribute("OutdatedMetadataUpdateInProgressException", typeof(OutdatedMetadataUpdateInProgressException))]
[JsonInheritanceAttribute("SortingSupportedOnlyOnTermsAndTermsRelationAggregatorsException", typeof(SortingSupportedOnlyOnTermsAndTermsRelationAggregatorsException))]
[JsonInheritanceAttribute("SchemasMetadataProtectionException", typeof(SchemasMetadataProtectionException))]
[JsonInheritanceAttribute("SchemaFieldOverwriteTypeMismatchException", typeof(SchemaFieldOverwriteTypeMismatchException))]
[JsonInheritanceAttribute("SchemaFieldOverwriteIdException", typeof(SchemaFieldOverwriteIdException))]
[JsonInheritanceAttribute("SchemaFieldIdDuplicatedException", typeof(SchemaFieldIdDuplicatedException))]
Expand Down Expand Up @@ -1431,6 +1432,8 @@ public static PictureparkBusinessException FromJson(string data)
[JsonInheritanceAttribute("SchemaParentChangeException", typeof(SchemaParentChangeException))]
[JsonInheritanceAttribute("SchemaMissingTypeException", typeof(SchemaMissingTypeException))]
[JsonInheritanceAttribute("SchemaPermissionConfigurationException", typeof(SchemaPermissionConfigurationException))]
[JsonInheritanceAttribute("SchemaMetadataProtectionSettingsNotSupportedForStructsException", typeof(SchemaMetadataProtectionSettingsNotSupportedForStructsException))]
[JsonInheritanceAttribute("SchemaMetadataProtectionSettingsChangeNotAllowedForXmpMappedLayersException", typeof(SchemaMetadataProtectionSettingsChangeNotAllowedForXmpMappedLayersException))]
[JsonInheritanceAttribute("SchemaNoLayerException", typeof(SchemaNoLayerException))]
[JsonInheritanceAttribute("SchemaIdException", typeof(SchemaIdException))]
[JsonInheritanceAttribute("SchemaInUseException", typeof(SchemaInUseException))]
Expand Down Expand Up @@ -5434,6 +5437,28 @@ public static SortingSupportedOnlyOnTermsAndTermsRelationAggregatorsException Fr

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
[Newtonsoft.Json.JsonObjectAttribute]
public partial class SchemasMetadataProtectionException : PictureparkValidationException
{
[Newtonsoft.Json.JsonProperty("schemaIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<string> SchemaIds { get; set; }

[Newtonsoft.Json.JsonProperty("operation", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Operation { get; set; }

public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
}

public static SchemasMetadataProtectionException FromJson(string data)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<SchemasMetadataProtectionException>(data);
}

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
[Newtonsoft.Json.JsonObjectAttribute]
public partial class SchemaFieldOverwriteTypeMismatchException : PictureparkValidationException
Expand Down Expand Up @@ -6312,6 +6337,44 @@ public static SchemaPermissionConfigurationException FromJson(string data)

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
[Newtonsoft.Json.JsonObjectAttribute]
public partial class SchemaMetadataProtectionSettingsNotSupportedForStructsException : PictureparkValidationException
{
[Newtonsoft.Json.JsonProperty("schemaId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SchemaId { get; set; }

public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
}

public static SchemaMetadataProtectionSettingsNotSupportedForStructsException FromJson(string data)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<SchemaMetadataProtectionSettingsNotSupportedForStructsException>(data);
}

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
[Newtonsoft.Json.JsonObjectAttribute]
public partial class SchemaMetadataProtectionSettingsChangeNotAllowedForXmpMappedLayersException : PictureparkValidationException
{
[Newtonsoft.Json.JsonProperty("schemaId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SchemaId { get; set; }

public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
}

public static SchemaMetadataProtectionSettingsChangeNotAllowedForXmpMappedLayersException FromJson(string data)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<SchemaMetadataProtectionSettingsChangeNotAllowedForXmpMappedLayersException>(data);
}

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
[Newtonsoft.Json.JsonObjectAttribute]
public partial class SchemaNoLayerException : PictureparkValidationException
Expand Down
103 changes: 103 additions & 0 deletions src/Picturepark.SDK.V1.Contract/Contracts.Generated.cs
Expand Up @@ -3348,6 +3348,7 @@ public static PictureparkBusinessException FromJson(string data)
[JsonInheritanceAttribute("LayerAssignmentInvalidException", typeof(LayerAssignmentInvalidException))]
[JsonInheritanceAttribute("OutdatedMetadataUpdateInProgressException", typeof(OutdatedMetadataUpdateInProgressException))]
[JsonInheritanceAttribute("SortingSupportedOnlyOnTermsAndTermsRelationAggregatorsException", typeof(SortingSupportedOnlyOnTermsAndTermsRelationAggregatorsException))]
[JsonInheritanceAttribute("SchemasMetadataProtectionException", typeof(SchemasMetadataProtectionException))]
[JsonInheritanceAttribute("SchemaFieldOverwriteTypeMismatchException", typeof(SchemaFieldOverwriteTypeMismatchException))]
[JsonInheritanceAttribute("SchemaFieldOverwriteIdException", typeof(SchemaFieldOverwriteIdException))]
[JsonInheritanceAttribute("SchemaFieldIdDuplicatedException", typeof(SchemaFieldIdDuplicatedException))]
Expand Down Expand Up @@ -3384,6 +3385,8 @@ public static PictureparkBusinessException FromJson(string data)
[JsonInheritanceAttribute("SchemaParentChangeException", typeof(SchemaParentChangeException))]
[JsonInheritanceAttribute("SchemaMissingTypeException", typeof(SchemaMissingTypeException))]
[JsonInheritanceAttribute("SchemaPermissionConfigurationException", typeof(SchemaPermissionConfigurationException))]
[JsonInheritanceAttribute("SchemaMetadataProtectionSettingsNotSupportedForStructsException", typeof(SchemaMetadataProtectionSettingsNotSupportedForStructsException))]
[JsonInheritanceAttribute("SchemaMetadataProtectionSettingsChangeNotAllowedForXmpMappedLayersException", typeof(SchemaMetadataProtectionSettingsChangeNotAllowedForXmpMappedLayersException))]
[JsonInheritanceAttribute("SchemaNoLayerException", typeof(SchemaNoLayerException))]
[JsonInheritanceAttribute("SchemaIdException", typeof(SchemaIdException))]
[JsonInheritanceAttribute("SchemaCountLimitReachedException", typeof(SchemaCountLimitReachedException))]
Expand Down Expand Up @@ -7382,6 +7385,28 @@ public static SortingSupportedOnlyOnTermsAndTermsRelationAggregatorsException Fr

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
[Newtonsoft.Json.JsonObjectAttribute]
public partial class SchemasMetadataProtectionException : PictureparkValidationException
{
[Newtonsoft.Json.JsonProperty("schemaIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<string> SchemaIds { get; set; }

[Newtonsoft.Json.JsonProperty("operation", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Operation { get; set; }

public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
}

public static SchemasMetadataProtectionException FromJson(string data)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<SchemasMetadataProtectionException>(data);
}

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
[Newtonsoft.Json.JsonObjectAttribute]
public partial class SchemaFieldOverwriteTypeMismatchException : PictureparkValidationException
Expand Down Expand Up @@ -8260,6 +8285,44 @@ public static SchemaPermissionConfigurationException FromJson(string data)

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
[Newtonsoft.Json.JsonObjectAttribute]
public partial class SchemaMetadataProtectionSettingsNotSupportedForStructsException : PictureparkValidationException
{
[Newtonsoft.Json.JsonProperty("schemaId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SchemaId { get; set; }

public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
}

public static SchemaMetadataProtectionSettingsNotSupportedForStructsException FromJson(string data)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<SchemaMetadataProtectionSettingsNotSupportedForStructsException>(data);
}

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
[Newtonsoft.Json.JsonObjectAttribute]
public partial class SchemaMetadataProtectionSettingsChangeNotAllowedForXmpMappedLayersException : PictureparkValidationException
{
[Newtonsoft.Json.JsonProperty("schemaId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SchemaId { get; set; }

public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
}

public static SchemaMetadataProtectionSettingsChangeNotAllowedForXmpMappedLayersException FromJson(string data)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<SchemaMetadataProtectionSettingsChangeNotAllowedForXmpMappedLayersException>(data);
}

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
[Newtonsoft.Json.JsonObjectAttribute]
public partial class SchemaNoLayerException : PictureparkValidationException
Expand Down Expand Up @@ -24302,6 +24365,10 @@ public partial class SchemaDetail
[Newtonsoft.Json.JsonProperty("searchFieldCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public SearchFieldCount SearchFieldCount { get; set; }

/// <summary>Metadata protection options.</summary>
[Newtonsoft.Json.JsonProperty("metadataProtection", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public MetadataProtection MetadataProtection { get; set; }

public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
Expand Down Expand Up @@ -25486,6 +25553,34 @@ public static SearchFieldCount FromJson(string data)

}

/// <summary>Metadata protection options</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class MetadataProtection
{
/// <summary>Prevent creation of items in ContentSchemas/Lists or assignments of Layers.</summary>
[Newtonsoft.Json.JsonProperty("preventCreate", Required = Newtonsoft.Json.Required.Always)]
public bool PreventCreate { get; set; }

/// <summary>Prevent updating metadata associated with schema.</summary>
[Newtonsoft.Json.JsonProperty("preventUpdate", Required = Newtonsoft.Json.Required.Always)]
public bool PreventUpdate { get; set; }

/// <summary>Prevent deletion of items in ContentSchemas/Lists or unassignments of Layers.</summary>
[Newtonsoft.Json.JsonProperty("preventDelete", Required = Newtonsoft.Json.Required.Always)]
public bool PreventDelete { get; set; }

public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
}

public static MetadataProtection FromJson(string data)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<MetadataProtection>(data);
}

}

/// <summary>Exists response</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class SchemaExistsResponse
Expand Down Expand Up @@ -25609,6 +25704,10 @@ public partial class SchemaUpdateRequest
[Newtonsoft.Json.JsonProperty("referencedInContentSchemaIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<string> ReferencedInContentSchemaIds { get; set; }

/// <summary>Metadata protection options.</summary>
[Newtonsoft.Json.JsonProperty("metadataProtection", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public MetadataProtection MetadataProtection { get; set; }

public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
Expand Down Expand Up @@ -25742,6 +25841,10 @@ public partial class SchemaCreateRequest
[Newtonsoft.Json.JsonProperty("referencedInContentSchemaIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<string> ReferencedInContentSchemaIds { get; set; }

/// <summary>Metadata protection options.</summary>
[Newtonsoft.Json.JsonProperty("metadataProtection", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public MetadataProtection MetadataProtection { get; set; }

public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
Expand Down
33 changes: 33 additions & 0 deletions src/Picturepark.SDK.V1.Tests/Clients/ContentTests.cs
Expand Up @@ -1989,6 +1989,39 @@ public async Task ShouldResolveHistoricVersionCount()
}
}

[Fact]
[Trait("Stack", "Contents")]
public async Task ShouldRespectProtectionFlagOnSchema()
{
var contentSchema = await _client.Schema.CreateAsync(
new SchemaCreateRequest
{
Id = $"ContentSchema{Guid.NewGuid():N}",
Types = new List<SchemaType> { SchemaType.Content },
ViewForAll = true,
Names = new TranslatedStringDictionary
{
["en"] = "Content schema"
},
MetadataProtection = new MetadataProtection
{
PreventCreate = false,
PreventUpdate = false,
PreventDelete = true
}
}).ConfigureAwait(false);

var content = await _client.Content.CreateAsync(
new ContentCreateRequest
{
ContentSchemaId = contentSchema.Schema.Id,
Content = new object()
}).ConfigureAwait(false);

var ex = await Record.ExceptionAsync(() => _client.Content.DeleteAsync(content.Id)).ConfigureAwait(false);
ex.Should().BeOfType<SchemasMetadataProtectionException>();
}

private static async Task AssertFileResponseOkAndNonEmpty(FileResponse response, string expectedContentType = null)
{
using (var stream = new MemoryStream())
Expand Down
2 changes: 2 additions & 0 deletions src/Picturepark.SDK.V1.Tests/Clients/ShareTests.cs
Expand Up @@ -585,6 +585,7 @@ public async Task ShouldContainDynamicOutputsEmbed()
}

[Fact]
[Trait("Stack", "Shares")]
public async Task ShouldRetrieveContentsBasedOnLimit()
{
// Arrange
Expand All @@ -599,6 +600,7 @@ public async Task ShouldRetrieveContentsBasedOnLimit()
}

[Fact]
[Trait("Stack", "Shares")]
public async Task ShouldPageOverContentsInShare()
{
// Arrange
Expand Down
58 changes: 58 additions & 0 deletions swagger/CloudManagerSwagger.json
Expand Up @@ -12746,6 +12746,30 @@
}
]
},
"SchemasMetadataProtectionException": {
"allOf": [
{
"$ref": "#/components/schemas/PictureparkValidationException"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"schemaIds": {
"type": "array",
"nullable": true,
"items": {
"type": "string"
}
},
"operation": {
"type": "string",
"nullable": true
}
}
}
]
},
"SchemaFieldOverwriteTypeMismatchException": {
"allOf": [
{
Expand Down Expand Up @@ -13618,6 +13642,40 @@
}
]
},
"SchemaMetadataProtectionSettingsNotSupportedForStructsException": {
"allOf": [
{
"$ref": "#/components/schemas/PictureparkValidationException"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"schemaId": {
"type": "string",
"nullable": true
}
}
}
]
},
"SchemaMetadataProtectionSettingsChangeNotAllowedForXmpMappedLayersException": {
"allOf": [
{
"$ref": "#/components/schemas/PictureparkValidationException"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"schemaId": {
"type": "string",
"nullable": true
}
}
}
]
},
"SchemaNoLayerException": {
"allOf": [
{
Expand Down