Skip to content

Commit

Permalink
Merge pull request #344 from blockfrost/fix/tx_metadata_label_json
Browse files Browse the repository at this point in the history
fix: anyOf compatibility with fast-json-stringify for pimtiive types
  • Loading branch information
vladimirvolek committed Feb 29, 2024
2 parents 739233a + 899fac6 commit 7a39f8e
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Unreleased changes are in the `master` branch.

- Parsing version 2 of `CIP68` metadata

### Fixed

- `tx_metadata_label_json` and `script_json` compatibility with fast-json-stringify for non-object/primitive types (eg. string)

## [0.1.61] - 2024-02-06

### Added
Expand Down
2 changes: 1 addition & 1 deletion json-schema.json

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -9551,7 +9551,6 @@
"description": "Transaction hash that contains the specific metadata"
},
"json_metadata": {
"additionalProperties": true,
"anyOf": [
{
"type": "string"
Expand All @@ -9572,9 +9571,11 @@
},
{
"type": "boolean"
},
{
"type": "null"
}
],
"nullable": true,
"description": "Content of the JSON metadata"
}
},
Expand Down Expand Up @@ -10968,7 +10969,6 @@
"type": "object",
"properties": {
"json": {
"additionalProperties": true,
"anyOf": [
{
"type": "string"
Expand All @@ -10989,9 +10989,11 @@
},
{
"type": "boolean"
},
{
"type": "null"
}
],
"nullable": true,
"description": "JSON contents of the `timelock` script, null for `plutus` scripts"
}
},
Expand Down
6 changes: 2 additions & 4 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7042,7 +7042,6 @@ components:
type: string
description: Transaction hash that contains the specific metadata
json_metadata:
additionalProperties: true
anyOf:
- type: string
- type: object
Expand All @@ -7052,7 +7051,7 @@ components:
- type: integer
- type: number
- type: boolean
nullable: true
- type: 'null'
description: Content of the JSON metadata
required:
- tx_hash
Expand Down Expand Up @@ -8065,7 +8064,6 @@ components:
type: object
properties:
json:
additionalProperties: true
anyOf:
- type: string
- type: object
Expand All @@ -8075,7 +8073,7 @@ components:
- type: integer
- type: number
- type: boolean
nullable: true
- type: 'null'
description: JSON contents of the `timelock` script, null for `plutus` scripts
required:
- json
Expand Down
12 changes: 4 additions & 8 deletions src/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5274,11 +5274,9 @@ export interface components {
/** @description Transaction hash that contains the specific metadata */
tx_hash: string;
/** @description Content of the JSON metadata */
json_metadata: ({
json_metadata: string | {
[key: string]: unknown;
} & (string | {
[key: string]: unknown;
} | unknown[] | number | boolean)) | null;
} | unknown[] | number | boolean | null;
})[];
/**
* @example [
Expand Down Expand Up @@ -6207,11 +6205,9 @@ export interface components {
*/
script_json: {
/** @description JSON contents of the `timelock` script, null for `plutus` scripts */
json: ({
[key: string]: unknown;
} & (string | {
json: string | {
[key: string]: unknown;
} | unknown[] | number | boolean)) | null;
} | unknown[] | number | boolean | null;
};
/**
* @example {
Expand Down
3 changes: 1 addition & 2 deletions src/schemas/scripts/script_json.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
type: object
properties:
json:
additionalProperties: true
anyOf:
- type: string
- type: object
Expand All @@ -11,7 +10,7 @@ properties:
- type: integer
- type: number
- type: boolean
nullable: true
- type: "null"
description: JSON contents of the `timelock` script, null for `plutus` scripts
required:
- json
Expand Down
3 changes: 1 addition & 2 deletions src/schemas/txs/tx_metadata_label_json.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ items:
type: string
description: Transaction hash that contains the specific metadata
json_metadata:
additionalProperties: true
anyOf:
- type: string
- type: object
Expand All @@ -16,7 +15,7 @@ items:
- type: integer
- type: number
- type: boolean
nullable: true
- type: "null"
description: Content of the JSON metadata
required:
- tx_hash
Expand Down
5 changes: 3 additions & 2 deletions test/tests/__snapshots__/get-schema-for-endpoint.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12543,7 +12543,6 @@ State \`gc\` means that a previously \`unpinned\` item has been garbage collecte
"items": {
"properties": {
"json_metadata": {
"additionalProperties": true,
"anyOf": [
{
"type": "string",
Expand All @@ -12565,9 +12564,11 @@ State \`gc\` means that a previously \`unpinned\` item has been garbage collecte
{
"type": "boolean",
},
{
"type": "null",
},
],
"description": "Content of the JSON metadata",
"nullable": true,
},
"tx_hash": {
"description": "Transaction hash that contains the specific metadata",
Expand Down
5 changes: 3 additions & 2 deletions test/tests/get-schema-for-endpoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,6 @@ describe('getSchemaForEndpoint', () => {
"items": {
"properties": {
"json_metadata": {
"additionalProperties": true,
"anyOf": [
{
"type": "string",
Expand All @@ -1480,9 +1479,11 @@ describe('getSchemaForEndpoint', () => {
{
"type": "boolean",
},
{
"type": "null",
},
],
"description": "Content of the JSON metadata",
"nullable": true,
},
"tx_hash": {
"description": "Transaction hash that contains the specific metadata",
Expand Down

0 comments on commit 7a39f8e

Please sign in to comment.