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

fix(#1687): fix building metadata body #1689

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ changes.
### Fixed

- Incorrect copy on DRep votes + other minor copy spelling mistakes
- Remove incorrect @value property to fix validating the metadata body [Issue 1687](https://github.com/IntersectMBO/govtool/issues/1687)

### Changed

Expand Down
Empty file.
1 change: 0 additions & 1 deletion govtool/frontend/src/consts/CIP100Context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const CIP_100_CONTEXT = {
"@language": "en-us",
CIP100:
"https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#",
hashAlgorithm: "CIP100:hashAlgorithm",
Expand Down
1 change: 0 additions & 1 deletion govtool/frontend/src/consts/dRepActions/jsonContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export const CIP_QQQ =
"https://github.com/cardano-foundation/CIPs/blob/master/CIP-QQQ/README.md#";

export const DREP_CONTEXT = {
"@language": "en-us",
CIP100:
"https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#",
CIPQQQ: CIP_QQQ,
Expand Down
1 change: 0 additions & 1 deletion govtool/frontend/src/consts/governanceAction/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export const GOVERNANCE_ACTION_FIELDS: GovernanceActionFields = {
} as const;

export const GOVERNANCE_ACTION_CONTEXT = {
"@language": "en-us",
CIP100:
"https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#",
CIP108:
Expand Down
26 changes: 7 additions & 19 deletions govtool/frontend/src/context/governanceAction.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,17 @@ import {
} from "./governanceAction";

const resultMetadataBody = {
abstract: {
"@value": "Test",
},
motivation: {
"@value": "Test",
},
rationale: {
"@value": "Test",
},
abstract: "Test",
motivation: "Test",
rationale: "Test",
references: [
{
"@type": "Other",
label: {
"@value": "Test",
},
uri: {
"@value": "http://example.com",
},
label: "Test",
uri: "http://example.com",
},
],
title: {
"@value": "Test",
},
title: "Test",
};

describe("GovernanceActionProvider", () => {
Expand Down Expand Up @@ -92,7 +80,7 @@ describe("GovernanceActionProvider", () => {
const hash = await createHash(jsonld!);
expect(hash).toBeDefined();
expect(hash).toBe(
"b84e9890a34d6e59a983cf8f695214162893de5fc5310b12b75f4fe3dab0d7ab",
"bbdbbe163d1b8e4d6c10180df515cc7d58109412d90a42e898fc66850b3fc98c",
);
};
test();
Expand Down
1 change: 0 additions & 1 deletion govtool/frontend/src/utils/tests/canonizeJSON.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { canonizeJSON } from "..";

const exampleJson = {
"@context": {
"@language": "en-us",
CIP100:
"https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#",
CIP108:
Expand Down
10,111 changes: 7,377 additions & 2,734 deletions govtool/frontend/yarn.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { cipStandardSchema } from './cipStandardSchema';

const validCIP108Data = {
'@context': {
'@language': 'en',
CIP100:
'https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#',
CIP108:
Expand Down Expand Up @@ -38,7 +37,6 @@ const validCIP108Data = {

const validCIPQQQData = {
'@context': {
'@language': 'en',
CIP100:
'https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#',
CIPQQQ:
Expand Down
44 changes: 13 additions & 31 deletions govtool/metadata-validation/src/schemas/cipStandardSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,25 @@ export const cipStandardSchema: StandardSpecification = {
// Source of CIP-108: https://github.com/Ryun1/CIPs/blob/governance-metadata-actions/CIP-0108/README.md
[MetadataStandard.CIP108]: Joi.object({
'@context': Joi.object({
'@language': Joi.string().required(),
CIP100: Joi.string().valid(CIP100_URL).required(),
CIP108: Joi.string().valid(CIP108_URL).required(),
hashAlgorithm: Joi.string().valid('CIP100:hashAlgorithm').required(),
body: Joi.object(),
authors: Joi.object(),
}),
authors: Joi.array(),
hashAlgorithm: Joi.object({
'@value': Joi.string().valid('blake2b-256').required(),
}),
hashAlgorithm: Joi.string().valid('blake2b-256').required(),
body: Joi.object({
title: Joi.object({
'@value': Joi.string().max(80).required(),
}).required(),
abstract: Joi.object({
'@value': Joi.string().max(2500).required(),
}).required(),
motivation: Joi.object({ '@value': Joi.string().required() }).required(),
rationale: Joi.object({ '@value': Joi.string().required() }).required(),
title: Joi.string().max(80).required(),
abstract: Joi.string().max(2500).required(),
motivation: Joi.string().required(),
rationale: Joi.string().required(),
references: Joi.array()
.items(
Joi.object({
'@type': Joi.string().required(),
label: Joi.object({
'@value': Joi.string().required(),
}).required(),
uri: Joi.object({
'@value': Joi.string().required(),
}).required(),
label: Joi.string().required(),
uri: Joi.string().required(),
referenceHash: Joi.object({
hashDigest: Joi.string().required(),
hashAlgorithm: Joi.string().required(),
Expand All @@ -58,31 +47,24 @@ export const cipStandardSchema: StandardSpecification = {
}),
[MetadataStandard.CIPQQQ]: Joi.object({
'@context': Joi.object({
'@language': Joi.string().required(),
CIP100: Joi.string().valid(CIP100_URL).required(),
CIPQQQ: Joi.string().valid(CIPQQQ_URL).required(),
hashAlgorithm: Joi.string().valid('CIP100:hashAlgorithm').required(),
body: Joi.object(),
authors: Joi.object(),
}),
authors: Joi.array(),
hashAlgorithm: Joi.object({
'@value': Joi.string().valid('blake2b-256').required(),
}),
hashAlgorithm: Joi.string().valid('blake2b-256').required(),
body: Joi.object({
bio: Joi.object({ '@value': Joi.string().allow('') }).required(),
dRepName: Joi.object({ '@value': Joi.string().allow('') }).required(),
email: Joi.object({ '@value': Joi.string().allow('') }).required(),
bio: Joi.string().allow(''),
dRepName: Joi.string().allow(''),
email: Joi.string().allow('').required(),
references: Joi.array()
.items(
Joi.object({
'@type': Joi.string(),
label: Joi.object({
'@value': Joi.string().allow('').required(),
}).required(),
uri: Joi.object({
'@value': Joi.string().required(),
}).required(),
label: Joi.string().allow('').required(),
uri: Joi.string().required(),
referenceHash: Joi.object({
hashDigest: Joi.string().required(),
hashAlgorithm: Joi.string().required(),
Expand Down
Loading