Skip to content

Commit

Permalink
Merge pull request #768 from vonpoland/799-filters-payload
Browse files Browse the repository at this point in the history
UNI-799: Apply filters to payload object.
  • Loading branch information
vonpoland authored Nov 17, 2023
2 parents 00f2f84 + 5708a6b commit 0f516b6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion maas-schemas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maas-schemas",
"version": "20.8.0",
"version": "20.9.0",
"description": "Schemas for MaaS infrastructure",
"main": "index.js",
"engine": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
"additionalProperties": false,
"required": ["identityId", "payload", "agencyId", "headers"],
"properties": {
"filters": {
"type": "string",
"pattern": "[a-zA-Z_]+==[\\-a-zA-Z0-9]+(?=[;,]|$)",
"description": "Schema for client filters which are passed to TSP-adapter. Based on https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters",
"examples": [
"ticketZone==ATM-m1,ticketZone==ATM-m2",
"ticketType==daily;ticketZone==ATM-m2"
]
},
"identityId": {
"$ref": "https://schemas.maas.global/core/components/units.json#/definitions/identityId"
},
Expand Down Expand Up @@ -105,6 +96,15 @@
"spaceDemand": {
"description": "Optional space demand. Example: 3 adults and 2 luggages.",
"$ref": "https://schemas.maas.global/core/components/spaceDemand.json#/definitions/spaceDemandString"
},
"filters": {
"type": "string",
"pattern": "[a-zA-Z_]+==[\\-a-zA-Z0-9]+(?=[;,]|$)",
"description": "Schema for client filters which are passed to TSP-adapter. Based on https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters",
"examples": [
"ticketZone==zone-m1,ticketZone==zone-m2",
"ticketType==daily;ticketZone==zone-m2"
]
}
},
"patternProperties": {
Expand Down
6 changes: 6 additions & 0 deletions maas-schemas/src/io-ts/_translation.log
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,12 @@ INFO: primitive type "string" used outside top-level definitions
in schemas/maas-backend/booking-virtual-create/request.json
WARNING: unexpected key in a $ref object
in schemas/maas-backend/bookings/bookings-agency-options/request.json
INFO: primitive type "string" used outside top-level definitions
in schemas/maas-backend/bookings/bookings-agency-options/request.json
WARNING: pattern field not supported outside top-level definitions
in schemas/maas-backend/bookings/bookings-agency-options/request.json
WARNING: examples field not supported outside top-level definitions
in schemas/maas-backend/bookings/bookings-agency-options/request.json
WARNING: patternProperty support has limitations
in schemas/maas-backend/bookings/bookings-agency-options/request.json
WARNING: unexpected key in a $ref object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export type Payload = t.Branded<
toRadius?: UnitsGeo_3e31_.Distance;
bookingIdToExtend?: Units_c404_.Uuid;
spaceDemand?: SpaceDemand_101a_.SpaceDemandString;
filters?: string;
} & Record<
string,
| TravelMode_5e34_.TravelMode
Expand All @@ -70,6 +71,7 @@ export type Payload = t.Branded<
| UnitsGeo_3e31_.Distance
| Units_c404_.Uuid
| SpaceDemand_101a_.SpaceDemandString
| string
| (string | number | boolean)
>,
PayloadBrand
Expand All @@ -91,6 +93,7 @@ export type PayloadC = t.BrandC<
toRadius: typeof UnitsGeo_3e31_.Distance;
bookingIdToExtend: typeof Units_c404_.Uuid;
spaceDemand: typeof SpaceDemand_101a_.SpaceDemandString;
filters: t.StringC;
}>,
t.RecordC<
t.StringC,
Expand All @@ -109,6 +112,7 @@ export type PayloadC = t.BrandC<
typeof UnitsGeo_3e31_.Distance,
typeof Units_c404_.Uuid,
typeof SpaceDemand_101a_.SpaceDemandString,
t.StringC,
t.UnionC<[t.StringC, t.NumberC, t.BooleanC]>,
]
>
Expand All @@ -133,6 +137,7 @@ export const Payload: PayloadC = t.brand(
toRadius: UnitsGeo_3e31_.Distance,
bookingIdToExtend: Units_c404_.Uuid,
spaceDemand: SpaceDemand_101a_.SpaceDemandString,
filters: t.string,
}),
t.record(
t.string,
Expand All @@ -150,6 +155,7 @@ export const Payload: PayloadC = t.brand(
UnitsGeo_3e31_.Distance,
Units_c404_.Uuid,
SpaceDemand_101a_.SpaceDemandString,
t.string,
t.union([t.string, t.number, t.boolean]),
]),
),
Expand All @@ -171,6 +177,7 @@ export const Payload: PayloadC = t.brand(
toRadius?: UnitsGeo_3e31_.Distance;
bookingIdToExtend?: Units_c404_.Uuid;
spaceDemand?: SpaceDemand_101a_.SpaceDemandString;
filters?: string;
} & Record<
string,
| TravelMode_5e34_.TravelMode
Expand All @@ -186,6 +193,7 @@ export const Payload: PayloadC = t.brand(
| UnitsGeo_3e31_.Distance
| Units_c404_.Uuid
| SpaceDemand_101a_.SpaceDemandString
| string
| (string | number | boolean)
>,
PayloadBrand
Expand All @@ -200,7 +208,6 @@ export type PayloadBrand = {
// The default export. More information at the top.
export type Request = t.Branded<
{
filters?: string;
identityId?: Units_c404_.IdentityId;
agencyId?: Common_ffba_.AgencyId;
payload?: Payload;
Expand All @@ -217,7 +224,6 @@ export type RequestC = t.BrandC<
t.IntersectionC<
[
t.PartialC<{
filters: t.StringC;
identityId: typeof Units_c404_.IdentityId;
agencyId: typeof Common_ffba_.AgencyId;
payload: typeof Payload;
Expand All @@ -236,7 +242,6 @@ export type RequestC = t.BrandC<
export const Request: RequestC = t.brand(
t.intersection([
t.partial({
filters: t.string,
identityId: Units_c404_.IdentityId,
agencyId: Common_ffba_.AgencyId,
payload: Payload,
Expand All @@ -253,7 +258,6 @@ export const Request: RequestC = t.brand(
x,
): x is t.Branded<
{
filters?: string;
identityId?: Units_c404_.IdentityId;
agencyId?: Common_ffba_.AgencyId;
payload?: Payload;
Expand Down

0 comments on commit 0f516b6

Please sign in to comment.