@pdtf/schemas 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4972,7 +4972,7 @@
4972
4972
  "title": "",
4973
4973
  "enum": [
4974
4974
  "Yes",
4975
- "No Certificate Served",
4975
+ "No",
4976
4976
  "Not applicable"
4977
4977
  ]
4978
4978
  }
@@ -4991,7 +4991,7 @@
4991
4991
  "properties": {
4992
4992
  "yesNoNotApplicable": {
4993
4993
  "enum": [
4994
- "No Certificate Served"
4994
+ "No"
4995
4995
  ]
4996
4996
  }
4997
4997
  }
@@ -6215,6 +6215,7 @@
6215
6215
  "enum": [
6216
6216
  "Enclosed",
6217
6217
  "To follow",
6218
+ "No",
6218
6219
  "Not applicable"
6219
6220
  ]
6220
6221
  },
@@ -6611,7 +6612,8 @@
6611
6612
  "title": "",
6612
6613
  "enum": [
6613
6614
  "Yes",
6614
- "No"
6615
+ "No",
6616
+ "Not applicable"
6615
6617
  ]
6616
6618
  }
6617
6619
  },
@@ -86,24 +86,57 @@ const extractOverlay = (sourceSchema, ref) => {
86
86
  jp.set(returnSchema, `${path}/${property}`, element[property]);
87
87
  }
88
88
  });
89
- const { discriminator } = element;
90
89
 
90
+ const { discriminator } = element;
91
91
  if (discriminator) {
92
92
  const { propertyName } = discriminator;
93
93
  element.oneOf.forEach((item, index) => {
94
94
  const discriminatorProperty = item.properties[propertyName];
95
- jp.set(
96
- returnSchema,
97
- `${path}/oneOf/${index}/properties/${propertyName}`,
98
- discriminatorProperty
99
- );
95
+ // copy const discriminator as-is
96
+ if (discriminatorProperty.const) {
97
+ jp.set(
98
+ returnSchema,
99
+ `${path}/oneOf/${index}/properties/${propertyName}/const`,
100
+ discriminatorProperty.const
101
+ );
102
+ } else {
103
+ // must be an enum
104
+ const discriminatorEnumPath = `${path}/oneOf/${index}/properties/${propertyName}/enum`;
105
+ // if a refEnum use that
106
+ const refEnum = `${ref}Enum`;
107
+ if (discriminatorProperty[refEnum]) {
108
+ jp.set(
109
+ returnSchema,
110
+ discriminatorEnumPath,
111
+ discriminatorProperty[refEnum]
112
+ );
113
+ } else {
114
+ // use the base enum
115
+ jp.set(
116
+ returnSchema,
117
+ discriminatorEnumPath,
118
+ discriminatorProperty.enum
119
+ );
120
+ }
121
+ }
100
122
  });
101
123
  }
102
124
  }
125
+
103
126
  const refRequired = `${ref}Required`;
104
127
  if (element[refRequired]) {
105
128
  jp.set(returnSchema, `${path}/required`, element[refRequired]);
106
129
  }
130
+
131
+ const refTitle = `${ref}Title`;
132
+ if (element[refTitle]) {
133
+ jp.set(returnSchema, `${path}/title`, element[refTitle]);
134
+ }
135
+
136
+ const refEnum = `${ref}Enum`;
137
+ if (element[refEnum]) {
138
+ jp.set(returnSchema, `${path}/enum`, element[refEnum]);
139
+ }
107
140
  });
108
141
  return returnSchema;
109
142
  };
@@ -136,6 +169,8 @@ const coreSchema = deleteProperties(combinedSchema, [
136
169
  "discriminator",
137
170
  ...extractFields.map((item) => `${item}Ref`),
138
171
  ...extractFields.map((item) => `${item}Required`),
172
+ ...extractFields.map((item) => `${item}Title`),
173
+ ...extractFields.map((item) => `${item}Enum`),
139
174
  ]);
140
175
 
141
176
  fs.writeFileSync(