Skip to content

Commit 531b632

Browse files
committed
Add global documentation handling and default value for Product field
1 parent 51a4902 commit 531b632

3 files changed

Lines changed: 134 additions & 6 deletions

File tree

actions/gls-action/scripts/generateTypes.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ of the GLS functions and can be referenced in your flows.
7878
value.type = `export type ${value.identifier} = ${value.type}`
7979
.replace(/ \| undefined/g, "")
8080

81-
8281
function breakDown(
8382
typeName: string,
8483
code: string
@@ -172,6 +171,7 @@ of the GLS functions and can be referenced in your flows.
172171
if (array) {
173172
type = type.getArrayElementTypeOrThrow()
174173
}
174+
let globalDocumentation: string
175175

176176
type.getProperties().forEach(property => {
177177
const name = property.getName();
@@ -189,9 +189,15 @@ of the GLS functions and can be referenced in your flows.
189189

190190
property.getJsDocTags().forEach(info => {
191191
info.getText().forEach(part => {
192+
if (info.getName() === "global") {
193+
globalDocumentation = (globalDocumentation || "") + "\n" + part.text.trim()
194+
return
195+
}
192196
docs[info.getName()] = part.text.trim()
193197
})
198+
194199
})
200+
195201
if (currTypeText.startsWith("GLS_")) {
196202
docs.link = currTypeText.toLowerCase()
197203
.replace(/-/g, "_")
@@ -211,12 +217,10 @@ of the GLS functions and can be referenced in your flows.
211217
const table = `<TypeTable type={{${typeString}}}
212218
/>`
213219
console.log(`# ${key}`)
220+
console.log(globalDocumentation || "\nNo documentation provided for this type.")
221+
console.log()
214222
console.log(table)
215223
}
216-
// console.log(`
217-
// # ${value.identifier} ${array ? "[]" : ""}
218-
// `)
219-
// console.log(table)
220224
})
221225

222226
})

actions/gls-action/src/types/glsShipment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const ShipmentSchema = z.object({
1212
ShipmentDate: z.date().optional(),
1313
IncotermCode: z.int().max(99).optional(),
1414
Identifier: z.string().max(40).optional(),
15-
Product: z.enum(["PARCEL", "EXPRESS"]),
15+
Product: z.enum(["PARCEL", "EXPRESS"]).default("PARCEL"),
1616
ExpressAltDeliveryAllowed: z.boolean().optional(),
1717
Consignee: ConsigneeSchema,
1818
Shipper: ShipperSchema.optional(),

0 commit comments

Comments
 (0)