Skip to content

Commit

Permalink
fix: brandAssets fix date format and remove gbfs description (#71)
Browse files Browse the repository at this point in the history
* fix: brandAssets fis date format and remove gbfs description

* fix: update zod version and generated schema-definitions

* fix: update zod version
  • Loading branch information
jorunnl authored Feb 5, 2025
1 parent bb07cf8 commit 42e61f7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 47 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"glob": "^9.3.2",
"js-yaml": "^4.1.0",
"yargs": "^17.7.1",
"zod": "^3.21.4",
"zod": "^3.24.1",
"zod-to-json-schema": "^3.20.4"
}
}
18 changes: 6 additions & 12 deletions schema-definitions/mobility.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,31 +130,25 @@
"type": "object",
"properties": {
"brandLastModified": {
"type": "string",
"format": "date-time",
"description": "Date that indicates the last time any included brand assets were updated or modified."
"type": "string"
},
"brandTermsUrl": {
"type": "string",
"format": "uri",
"description": "A fully qualified URL pointing to the location of a page that defines the license terms of brand icons, colors, or other trademark information. This field MUST NOT take the place of license_url or license_id."
"format": "uri"
},
"brandImageUrl": {
"type": "string",
"description": "A fully qualified URL pointing to the location of a graphic file representing the brand for the service. File MUST be in SVG V1.1 format and MUST be either square or round."
"type": "string"
},
"brandImageUrlDark": {
"type": "string",
"description": "A fully qualified URL pointing to the location of a graphic file representing the brand for the service for use in dark mode applications. File MUST be in SVG V1.1 format and MUST be either square or round."
"type": "string"
},
"color": {
"type": "string",
"description": "Color used to represent the brand for the service expressed as a 6 digit hexadecimal color code in the form #000000."
"type": "string"
}
},
"required": ["brandLastModified", "brandImageUrl"],
"additionalProperties": false,
"description": "modeled 1-1 like brandAssets in GBFS"
"description": "modeled 1-1 like brandAssets in EnTur mobility API"
}
},
"required": ["id", "name", "formFactors"],
Expand Down
36 changes: 6 additions & 30 deletions src/mobility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,14 @@ export const MobilityOperator = z.object({
benefits: z.array(OperatorBenefit).optional().default([]),
brandAssets: z
.object({
brandLastModified: z
.date()
.describe(
'Date that indicates the last time any included brand assets were updated or modified.',
),
brandTermsUrl: z
.string()
.url()
.optional()
.describe(
'A fully qualified URL pointing to the location of a page that defines the license terms of brand icons, colors, or other trademark information. This field MUST NOT take the place of license_url or license_id.',
),
brandImageUrl: z
.string()
.describe(
'A fully qualified URL pointing to the location of a graphic file representing the brand for the service. File MUST be in SVG V1.1 format and MUST be either square or round.',
),
brandImageUrlDark: z
.string()
.optional()
.describe(
'A fully qualified URL pointing to the location of a graphic file representing the brand for the service for use in dark mode applications. File MUST be in SVG V1.1 format and MUST be either square or round.',
),
color: z
.string()
.optional()
.describe(
'Color used to represent the brand for the service expressed as a 6 digit hexadecimal color code in the form #000000.',
),
brandLastModified: z.string().date(),
brandTermsUrl: z.string().url().optional(),
brandImageUrl: z.string(),
brandImageUrlDark: z.string().optional(),
color: z.string().optional(),
})
.optional()
.describe('modeled 1-1 like brandAssets in GBFS'),
.describe('modeled 1-1 like brandAssets in EnTur mobility API'),
});

export type MobilityOperatorType = z.infer<typeof MobilityOperator>;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ zod-to-json-schema@^3.20.4:
resolved "https://registry.yarnpkg.com/zod-to-json-schema/-/zod-to-json-schema-3.20.4.tgz#155f687c5a059fdc0f1bb3ff32d6e9200036b6f4"
integrity sha512-Un9+kInJ2Zt63n6Z7mLqBifzzPcOyX+b+Exuzf7L1+xqck9Q2EPByyTRduV3kmSPaXaRer1JCsucubpgL1fipg==

zod@^3.21.4:
version "3.21.4"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.21.4.tgz#10882231d992519f0a10b5dd58a38c9dabbb64db"
integrity sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==
zod@^3.24.1:
version "3.24.1"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.24.1.tgz#27445c912738c8ad1e9de1bea0359fa44d9d35ee"
integrity sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==

0 comments on commit 42e61f7

Please sign in to comment.