Skip to content

Commit

Permalink
Merge branch 'main' into fix/correct-altinn-nuget-version
Browse files Browse the repository at this point in the history
  • Loading branch information
martinothamar authored Jan 18, 2025
2 parents 29b9689 + 8663bad commit bdf58e3
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 48 deletions.
11 changes: 6 additions & 5 deletions src/Altinn.App.Api/Models/DataPatchResponseMultiple.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using Altinn.App.Api.Controllers;
using Altinn.App.Core.Models.Validation;
Expand All @@ -13,19 +14,19 @@ public class DataPatchResponseMultiple
/// <summary>
/// The validation issues that were found during the patch operation.
/// </summary>
[JsonPropertyName("validationIssues")]
[JsonPropertyName("validationIssues"), Required]
public required List<ValidationSourcePair> ValidationIssues { get; init; }

/// <summary>
/// The current data in all data models updated by the patch operation.
/// </summary>
[JsonPropertyName("newDataModels")]
[JsonPropertyName("newDataModels"), Required]
public required List<DataModelPairResponse> NewDataModels { get; init; }

/// <summary>
/// The instance with updated dataElement list.
/// </summary>
[JsonPropertyName("instance")]
[JsonPropertyName("instance"), Required]
public required Instance Instance { get; init; }
}

Expand All @@ -35,6 +36,6 @@ public class DataPatchResponseMultiple
/// <param name="DataElementId">The guid of the DataElement</param>
/// <param name="Data">The form data of the data element</param>
public record DataModelPairResponse(
[property: JsonPropertyName("dataElementId")] Guid DataElementId,
[property: JsonPropertyName("data")] object Data
[property: JsonPropertyName("dataElementId"), Required] Guid DataElementId,
[property: JsonPropertyName("data"), Required] object Data
);
11 changes: 6 additions & 5 deletions src/Altinn.App.Api/Models/DataPostResponse.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.Net;
using System.Text.Json.Serialization;
using Altinn.App.Core.Models.Validation;
Expand All @@ -14,25 +15,25 @@ public class DataPostResponse
/// <summary>
/// The Id of the created data element
/// </summary>
[JsonPropertyName("newDataElementId")]
[JsonPropertyName("newDataElementId"), Required]
public required Guid NewDataElementId { get; init; }

/// <summary>
/// The instance with updated data
/// </summary>
[JsonPropertyName("instance")]
[JsonPropertyName("instance"), Required]
public required Instance Instance { get; init; }

/// <summary>
/// List of validation issues that reported to have relevant changes after a new data element was added
/// </summary>
[JsonPropertyName("validationIssues")]
[JsonPropertyName("validationIssues"), Required]
public required List<ValidationSourcePair> ValidationIssues { get; init; }

/// <summary>
/// List of updated DataModels caused by dataProcessing
/// </summary>
[JsonPropertyName("newDataModels")]
[JsonPropertyName("newDataModels"), Required]
public required List<DataModelPairResponse> NewDataModels { get; init; }
}

Expand All @@ -55,6 +56,6 @@ public DataPostErrorResponse(string detail, List<ValidationIssueWithSource> vali
/// <summary>
/// List of the validators that reported to have relevant changes after a new data element was added
/// </summary>
[JsonPropertyName("uploadValidationIssues")]
[JsonPropertyName("uploadValidationIssues"), Required]
public List<ValidationIssueWithSource> UploadValidationIssues { get; }
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using Altinn.App.Core.Features;

Expand Down Expand Up @@ -70,7 +71,7 @@ public static ValidationIssueWithSource FromIssue(ValidationIssue issue, string
/// <summary>
/// The short name of the class that crated the message (set automatically after return of list)
/// </summary>
[JsonPropertyName("source")]
[JsonPropertyName("source"), Required]
public required string Source { get; set; }

/// <summary>
Expand Down Expand Up @@ -106,6 +107,6 @@ public static ValidationIssueWithSource FromIssue(ValidationIssue issue, string
/// <param name="Source">The <see cref="IValidator.ValidationSource"/> for the Validator that created theese issues</param>
/// <param name="Issues">List of issues</param>
public record ValidationSourcePair(
[property: JsonPropertyName("source")] string Source,
[property: JsonPropertyName("issues")] List<ValidationIssueWithSource> Issues
[property: JsonPropertyName("source"), Required] string Source,
[property: JsonPropertyName("issues"), Required] List<ValidationIssueWithSource> Issues
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
openapi: 3.0.1,
info: {
title: Altinn App Api,
Expand Down Expand Up @@ -6442,6 +6442,10 @@ to a model, and then finally the state of the instance.,
additionalProperties: false
},
DataModelPairResponse: {
required: [
data,
dataElementId
],
type: object,
properties: {
dataElementId: {
Expand All @@ -6450,8 +6454,7 @@ to a model, and then finally the state of the instance.,
format: uuid
},
data: {
description: The form data of the data element,
nullable: true
description: The form data of the data element
}
},
additionalProperties: false,
Expand Down Expand Up @@ -6555,16 +6558,14 @@ version that supports multiple data models in the same request.
items: {
$ref: #/components/schemas/ValidationSourcePair
},
description: The validation issues that were found during the patch operation.,
nullable: true
description: The validation issues that were found during the patch operation.
},
newDataModels: {
type: array,
items: {
$ref: #/components/schemas/DataModelPairResponse
},
description: The current data in all data models updated by the patch operation.,
nullable: true
description: The current data in all data models updated by the patch operation.
},
instance: {
$ref: #/components/schemas/Instance
Expand All @@ -6574,6 +6575,9 @@ version that supports multiple data models in the same request.
description: Represents the response from a data patch operation on the Altinn.App.Api.Controllers.DataController.
},
DataPostErrorResponse: {
required: [
uploadValidationIssues
],
type: object,
properties: {
type: {
Expand Down Expand Up @@ -6603,7 +6607,6 @@ version that supports multiple data models in the same request.
$ref: #/components/schemas/ValidationIssueWithSource
},
description: List of the validators that reported to have relevant changes after a new data element was added,
nullable: true,
readOnly: true
}
},
Expand Down Expand Up @@ -6631,16 +6634,14 @@ version that supports multiple data models in the same request.
items: {
$ref: #/components/schemas/ValidationSourcePair
},
description: List of validation issues that reported to have relevant changes after a new data element was added,
nullable: true
description: List of validation issues that reported to have relevant changes after a new data element was added
},
newDataModels: {
type: array,
items: {
$ref: #/components/schemas/DataModelPairResponse
},
description: List of updated DataModels caused by dataProcessing,
nullable: true
description: List of updated DataModels caused by dataProcessing
}
},
additionalProperties: false,
Expand Down Expand Up @@ -8147,8 +8148,8 @@ Validators that are not listed in the dictionary are assumed to have not been ex
nullable: true
},
source: {
type: string,
nullable: true
minLength: 1,
type: string
},
noIncrementalUpdates: {
type: boolean
Expand All @@ -8168,18 +8169,21 @@ Validators that are not listed in the dictionary are assumed to have not been ex
additionalProperties: false
},
ValidationSourcePair: {
required: [
issues,
source
],
type: object,
properties: {
source: {
type: string,
nullable: true
minLength: 1,
type: string
},
issues: {
type: array,
items: {
$ref: #/components/schemas/ValidationIssueWithSource
},
nullable: true
}
}
},
additionalProperties: false
Expand Down
38 changes: 21 additions & 17 deletions test/Altinn.App.Api.Tests/OpenApi/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6443,6 +6443,10 @@
"additionalProperties": false
},
"DataModelPairResponse": {
"required": [
"data",
"dataElementId"
],
"type": "object",
"properties": {
"dataElementId": {
Expand All @@ -6451,8 +6455,7 @@
"format": "uuid"
},
"data": {
"description": "The form data of the data element",
"nullable": true
"description": "The form data of the data element"
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -6550,16 +6553,14 @@
"items": {
"$ref": "#/components/schemas/ValidationSourcePair"
},
"description": "The validation issues that were found during the patch operation.",
"nullable": true
"description": "The validation issues that were found during the patch operation."
},
"newDataModels": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DataModelPairResponse"
},
"description": "The current data in all data models updated by the patch operation.",
"nullable": true
"description": "The current data in all data models updated by the patch operation."
},
"instance": {
"$ref": "#/components/schemas/Instance"
Expand All @@ -6569,6 +6570,9 @@
"description": "Represents the response from a data patch operation on the Altinn.App.Api.Controllers.DataController."
},
"DataPostErrorResponse": {
"required": [
"uploadValidationIssues"
],
"type": "object",
"properties": {
"type": {
Expand Down Expand Up @@ -6598,7 +6602,6 @@
"$ref": "#/components/schemas/ValidationIssueWithSource"
},
"description": "List of the validators that reported to have relevant changes after a new data element was added",
"nullable": true,
"readOnly": true
}
},
Expand Down Expand Up @@ -6627,16 +6630,14 @@
"items": {
"$ref": "#/components/schemas/ValidationSourcePair"
},
"description": "List of validation issues that reported to have relevant changes after a new data element was added",
"nullable": true
"description": "List of validation issues that reported to have relevant changes after a new data element was added"
},
"newDataModels": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DataModelPairResponse"
},
"description": "List of updated DataModels caused by dataProcessing",
"nullable": true
"description": "List of updated DataModels caused by dataProcessing"
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -8143,8 +8144,8 @@
"nullable": true
},
"source": {
"type": "string",
"nullable": true
"minLength": 1,
"type": "string"
},
"noIncrementalUpdates": {
"type": "boolean"
Expand All @@ -8164,18 +8165,21 @@
"additionalProperties": false
},
"ValidationSourcePair": {
"required": [
"issues",
"source"
],
"type": "object",
"properties": {
"source": {
"type": "string",
"nullable": true
"minLength": 1,
"type": "string"
},
"issues": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationIssueWithSource"
},
"nullable": true
}
}
},
"additionalProperties": false
Expand Down

0 comments on commit bdf58e3

Please sign in to comment.