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

update deliveryStatement #979

Merged
merged 1 commit into from
Oct 10, 2024
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
32 changes: 31 additions & 1 deletion docs/openapi/components/schemas/common/DeliveryStatement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,36 @@ properties:
$linkedData:
term: deliveredVolume
'@id': https://schema.org/MeasuredValue
carrier:
title: Carrier
description: >-
The party providing the transport of goods in this consignment between
named points.
$ref: ./Organization.yml
$linkedData:
term: transporter
'@id': https://schema.org/agent
consignor:
title: Consignor
description: >-
The party consigning goods, as stipulated in the transport contract by the
party ordering transport.
$ref: ./Organization.yml
$linkedData:
term: consignor
'@id': >-
https://vocabulary.uncefact.org/consignorParty
notificationOfShipment:
title: Notification of Shipment Month
description: Year and month of the notification of shipment statement
type: string
destination:
title: Delivery Destination
description: The address to which the commodity is being shipped
$ref: ./Place.yml
$linkedData:
term: place
'@id': https://schema.org/toLocation
observation:
title: Observation List
description: List of observations
Expand All @@ -47,7 +77,7 @@ properties:
$linkedData:
term: observation
'@id': https://w3id.org/traceability#observation
additionalProperties: false
additionalProperties: false
required:
- type
example: |-
Expand Down
29 changes: 15 additions & 14 deletions packages/traceability-schemas/scripts/schemas-to-vocab.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable operator-linebreak */
const fs = require('fs');
const path = require('path');
const { load } = require('js-yaml')
const { load } = require('js-yaml');

const { schemas } = require('../services/schemas');

Expand All @@ -25,7 +25,7 @@ const buildLinkedDataTable = (schema) => {
if (!$linkedData) {
return '';
}

const section = `

<table class="simple">
Expand Down Expand Up @@ -76,9 +76,9 @@ const buildClass = (schema) => {
}

const props = schema.properties ? Object.keys(schema.properties) : [];
let catair = ``;
const {$id} = schema;
if (schema.tags && schema.tags.includes(htmlSectionSchemaTags) ) {
let catair = '';
const { $id } = schema;
if (schema.tags && schema.tags.includes(htmlSectionSchemaTags)) {
const htmlExtension = $id.split('/').pop().replace('.yml', '.html');
catair = fs.readFileSync(path.resolve(
__dirname,
Expand Down Expand Up @@ -135,22 +135,23 @@ const separateSchemas = (schemaList) => {
};

const buildWorkflowSection = () => {

const files = fs.readdirSync(
path.resolve(__dirname, '../../../docs/openapi/components/schemas/workflows')
);

const w = [];
files.forEach( file => {
files.forEach((file) => {
const ymlText = fs.readFileSync(
path.resolve(__dirname, `../../../docs/openapi/components/schemas/workflows/${file}`)
)
);
const yml = load(ymlText);
const { title, description, credentials, mermaid } = yml;

const types = credentials.reduce( (prev, curr) => {
const {
title, description, credentials, mermaid
} = yml;

const types = credentials.reduce((prev, curr) => {
const { name, id } = curr;
const li = `<li><a href="${id}">${name}</a></li>`
const li = `<li><a href="${id}">${name}</a></li>`;
return prev + li;
}, '');

Expand All @@ -164,10 +165,10 @@ const buildWorkflowSection = () => {
</ol>
<pre class='example yml'>${ymlText}</pre>
`);
})
});

return w.join('\n');
}
};

(() => {
console.log('🧪 build vocab from schemas');
Expand Down
4 changes: 2 additions & 2 deletions packages/traceability-tests/examples/v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"examples": [
{
"issued": "eyJpc3MiOiJkaWQ6andrOmV5SnJkSGtpT2lKRlF5SXNJbU55ZGlJNklsQXRNemcwSWl3aVlXeG5Jam9pUlZNek9EUWlMQ0o0SWpvaU9XcHpSbEpXVm1weFNsazFTa2w1U25JMU9HZEZRblZ5YW10emFreHdUVUp2V1ZaRFpUWmxNRUo2VXpoQlV6Tk1RWGx5TjNoTGVGTm5VRTlwVUdOSFRTSXNJbmtpT2lKaWRIUk1YMlpWYTNSa2NpMU1hSGhOWTNwSmFtbDBaRnBXY0c5cG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
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/ns/activitystreams"
],
"id": "urn:uuid:714cfd73-c52e-4ba8-9392-7062e6540088",
"id": "urn:uuid:8a3227d4-dfaf-460c-8f63-ed4a802ce362",
"type": [
"VerifiableCredential",
"ActivityPubActorCard"
Expand Down
Loading