Skip to content

Commit

Permalink
Optional properties specified as required in OpenAPI (#351)
Browse files Browse the repository at this point in the history
* fix: optional expiresAt of File documented as required

* fix: optional title of File is documented as required

* fix: test names containing template instead of file

* refactor: write QR Code consistently separated

* feat: add missing documented QR Code option in description
  • Loading branch information
britsta authored Jan 24, 2025
1 parent 88270d2 commit 85d94e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
14 changes: 6 additions & 8 deletions src/modules/coreHttpApi/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1836,8 +1836,6 @@ paths:
format: binary
nullable: false
required:
- title
- expiresAt
- file
responses:
201:
Expand Down Expand Up @@ -2048,7 +2046,7 @@ paths:
get:
operationId: getFileMetadata
description: |
Gets metadata for the file with the given `idOrReference` when the accept header is set to `application/json` or a QrCode containing the reference to the file if the accept header it set to `image/png`.
Gets metadata for the file with the given `idOrReference` when the accept header is set to `application/json` or a QR Code containing the reference to the file if the accept header it set to `image/png`.
`idOrReference` can either be a FileId (starting with `FIL`) or a FileReference (starting with `RklM`).
tags:
Expand Down Expand Up @@ -2134,7 +2132,7 @@ paths:
/api/v2/Files/{id}/Token:
post:
operationId: createTokenForFile
description: Creates a `Token` for the `File` with the given `id`.
description: Creates a `Token` for the `File` with the given `id`. If the accept header is set to `image/png` instead of `application/json`, a QR Code containing the reference to the token is shown.
tags:
- Files
parameters:
Expand All @@ -2155,7 +2153,7 @@ paths:
type: string
format: date-time
ephemeral:
description: If set to true the token will will not be cached in the database of the connector. Note that you will not be able to fetch this token unless you remember the truncatedReference of the token. Defaults to true. Will be ignored if Accept is set to image/png.
description: If set to true the token will will not be cached in the database of the connector. Note that you will not be able to fetch this token unless you remember the truncatedReference of the token. Defaults to true. Will be ignored if the accept header is set to `image/png`.
type: boolean
forIdentity:
$ref: "#/components/schemas/Address"
Expand Down Expand Up @@ -3533,7 +3531,7 @@ paths:
/api/v2/RelationshipTemplates/{id}:
get:
operationId: getRelationshipTemplate
description: Fetches the `RelationshipTemplate` with the given `id` when the accept header is set to `application/json` or a QrCode containing the reference to the RelationshipTemplate if the accept header it set to `image/png`.
description: Fetches the `RelationshipTemplate` with the given `id` when the accept header is set to `application/json` or a QR Code containing the reference to the RelationshipTemplate if the accept header it set to `image/png`.
tags:
- RelationshipTemplates
parameters:
Expand Down Expand Up @@ -3578,7 +3576,7 @@ paths:
/api/v2/RelationshipTemplates/Own/{id}/Token:
post:
operationId: createTokenForTemplate
description: Creates a `Token` for the own `RelationshipTemplate` with the given `id`
description: Creates a `Token` for the own `RelationshipTemplate` with the given `id`. If the accept header is set to `image/png` instead of `application/json`, a QR Code containing the reference to the token is shown.
tags:
- RelationshipTemplates
parameters:
Expand All @@ -3599,7 +3597,7 @@ paths:
type: string
format: date-time
ephemeral:
description: If set to true the token will will not be cached in the database of the connector. Note that you will not be able to fetch this token unless you remember the truncatedReference of the token. Defaults to true. Will be ignored if Accept is set to image/png.
description: If set to true the token will will not be cached in the database of the connector. Note that you will not be able to fetch this token unless you remember the truncatedReference of the token. Defaults to true. Will be ignored if the accept header is set to `image/png`.
type: boolean
forIdentity:
$ref: "#/components/schemas/Address"
Expand Down
4 changes: 2 additions & 2 deletions test/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ describe("Load peer file with reference", () => {
});

describe("Password-protected tokens for files", () => {
test("send and receive an unprotected template via password-protected token", async () => {
test("send and receive an unprotected file via password-protected token", async () => {
const file = await uploadFile(client1);
const token = (await client1.files.createTokenForFile(file.id, { passwordProtection: { password: "password" } })).result;
expect(token.passwordProtection?.password).toBe("password");
Expand All @@ -327,7 +327,7 @@ describe("Password-protected tokens for files", () => {
expect(response).toBeSuccessful(ValidationSchema.File);
});

test("send and receive an unprotected template via PIN-protected token", async () => {
test("send and receive an unprotected file via PIN-protected token", async () => {
const file = await uploadFile(client1);
const token = (await client1.files.createTokenForFile(file.id, { passwordProtection: { password: "1234", passwordIsPin: true } })).result;
expect(token.passwordProtection?.password).toBe("1234");
Expand Down

0 comments on commit 85d94e7

Please sign in to comment.