Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Gann committed Dec 19, 2023
1 parent 3fb84c3 commit fb7664d
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,3 @@ export interface CreateAndShareRelationshipAttributeRequest {
expiresAt?: string;
};
}

// TODO: Warum gibt es keine CreateAttributeRequest.ts?
// TODO: Watum importieren wir nicht die Datentype aus runtime?
4 changes: 3 additions & 1 deletion src/modules/coreHttpApi/controllers/AttributesController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export class AttributesController extends BaseController {
@POST
@Accept("application/json")
public async createAttribute(request: any): Promise<Return.NewResource<Envelope>> {
// TODO request.content contains unnecessary owner value => delete?
// owner is left optional in openapi spec for backward compatibility
if (request.content.owner) delete request.content.owner;
const result = await this.consumptionServices.attributes.createIdentityAttribute(request);
return this.created(result);
}
Expand Down Expand Up @@ -45,6 +46,7 @@ export class AttributesController extends BaseController {
return this.created(result);
}

// TODO: delete succeedAttribute?
@POST
@Path("/SucceedAttribute")
@Accept("application/json")
Expand Down
110 changes: 79 additions & 31 deletions src/modules/coreHttpApi/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ paths:
additionalProperties: false
properties:
content:
"$ref": "#/components/schemas/IdentityAttribute" # TODO: specifies owner to be mandatory => we do not use this field
"$ref": "#/components/schemas/CreateAttributeRequest"
required:
- content
type: object
Expand All @@ -304,13 +304,12 @@ paths:
application/json:
schema:
type: object
properties:
result:
type: object
nullable: false
$ref: "#/components/schemas/Attribute"
required:
- result
properties:
result:
$ref: "#/components/schemas/CreateIdentityAttributeResponse"

headers:
X-Response-Duration-ms:
schema:
Expand Down Expand Up @@ -451,8 +450,6 @@ paths:
type: object
properties:
result:
type: object
nullable: false
$ref: "#/components/schemas/Request"
required:
- result
Expand Down Expand Up @@ -492,9 +489,7 @@ paths:
- result
properties:
result:
type: object
nullable: false
$ref: "#/components/schemas/IdentityAttribute"
$ref: "#/components/schemas/CreateIdentityAttributeResponse"
headers:
X-Response-Duration-ms:
schema:
Expand Down Expand Up @@ -528,8 +523,8 @@ paths:
type: object
properties:
result:
nullable: false
type: object
additionalProperties: false
required:
- predecessor
- successor
Expand Down Expand Up @@ -575,8 +570,6 @@ paths:
type: object
properties:
result:
nullable: false
type: object
$ref: "#/components/schemas/Request"
required:
- result
Expand Down Expand Up @@ -688,7 +681,12 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/SucceedRelationshipAttributeAndNotifyPeerResponse"
type: object
required:
- result
properties:
result:
$ref: "#/components/schemas/SucceedRelationshipAttributeAndNotifyPeerResponse"
headers:
X-Response-Duration-ms:
schema:
Expand Down Expand Up @@ -3847,10 +3845,7 @@ components:
- $ref: "#/components/schemas/Address"
description: The address of the identity that owns the attribute.
tags:
type: array
items:
type: string
description: The tags of the attribute.
$ref: "#/components/schemas/IdentityAttributeContent_tags"
validFrom:
$ref: "#/components/schemas/AttributeContent_validFrom"
validTo:
Expand Down Expand Up @@ -4492,6 +4487,29 @@ components:
- content
- peer

CreateAttributeRequest:
type: object
additionalProperties: false
required:
- content
properties:
content:
type: object
additionalProperties: false
required:
- value
properties:
owner:
$ref: "#/components/schemas/Address"
value:
$ref: "#/components/schemas/AttributeValue"
tags:
$ref: "#/components/schemas/IdentityAttributeContent_tags"
validFrom:
$ref: "#/components/schemas/AttributeContent_validFrom"
validTo:
$ref: "#/components/schemas/AttributeContent_validTo"

CreateIdentityAttributeRequest:
type: object
additionalProperties: false
Expand Down Expand Up @@ -4555,6 +4573,41 @@ components:
sucessor:
$ref: "#/components/schemas/IdentityAttribute"

CreateIdentityAttributeResponse:
type: object
additionalProperties: false
properties:
id:
allOf:
- $ref: "#/components/schemas/AttributeID"
nullable: false
description: The ID of the attribute.
parentId:
"$ref": "#/components/schemas/AttributeID"
createdAt:
type: string
format: date-time
description: The date and time when the attribute was created.
shareInfo:
"$ref": "#/components/schemas/AttributeShareInfo"
succeededBy:
type: string
allOf:
- $ref: "#/components/schemas/AttributeID"
description: The ID of the attribute that was used to succeed this attribute.
succeeds:
type: string
allOf:
- $ref: "#/components/schemas/AttributeID"
description: The ID of the attribute that this attribute succeeds.
content:
anyOf:
- "$ref": "#/components/schemas/IdentityAttribute"
required:
- id
- createdAt
- content

NotifyPeerAboutIdentityAttributeSuccessionRequest:
type: object
additionalProperties: false
Expand Down Expand Up @@ -4591,6 +4644,7 @@ components:

RequestMetadata:
type: object
additionalProperties: false
properties:
title:
type: string
Expand Down Expand Up @@ -4660,19 +4714,13 @@ components:
type: object
additionalProperties: false
required:
- result
- predecessor
- successor
properties:
result:
type: object
additionalProperties: false
required:
- predecessor
- successor
properties:
predecessor:
$ref: "#/components/schemas/RelationshipAttribute"
successor:
$ref: "#/components/schemas/RelationshipAttribute"
predecessor:
$ref: "#/components/schemas/RelationshipAttribute"
successor:
$ref: "#/components/schemas/RelationshipAttribute"

ShareIdentityAttributeRequest:
type: object
Expand Down

0 comments on commit fb7664d

Please sign in to comment.