@opengeoweb/sigmet-airmet 4.22.1 → 5.0.1
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.
- package/README.md +12 -6
- package/index.js +16 -9297
- package/package.json +7 -9
- package/src/lib/components/MapViewGeoJson/utils.d.ts +3 -3
- package/src/lib/components/ProductForms/ProductFormFields/SelectFIR.d.ts +1 -1
- package/src/lib/components/ProductForms/utils.d.ts +1 -1
- package/src/lib/utils/config/config.d.ts +11 -1
package/README.md
CHANGED
|
@@ -115,22 +115,28 @@ These are the default configuration files for both products. They are being used
|
|
|
115
115
|
|
|
116
116
|
Schema files define all required properties and types for the configuration files. Sigmet and airmet share some properties, these can be found in `firArea.schema.json`.
|
|
117
117
|
|
|
118
|
-
- firArea.schema: `
|
|
118
|
+
- firArea.schema: `tools/build-static-schemas/firArea.schema.json`
|
|
119
119
|
Defines the shared properties and validations of sigmet and airmet.
|
|
120
|
-
- airmet.schema: `
|
|
120
|
+
- airmet.schema: `tools/build-static-schemas/airmet.schema.json`
|
|
121
121
|
Defines the airmet config validations. Airmet uses the firArea scheme and adds unique properties via the $merge prop: ```"$merge": {
|
|
122
122
|
"source": { "$ref": "firArea.schema.json" } ```
|
|
123
|
-
- sigmet.schema: `
|
|
123
|
+
- sigmet.schema: `tools/build-static-schemas/sigmet.schema.json`
|
|
124
124
|
Defines the sigmet config validations. Sigmet uses the firArea scheme and adds unique properties via the $merge prop: ```"$merge": {
|
|
125
125
|
"source": { "$ref": "firArea.schema.json" } ```
|
|
126
126
|
|
|
127
|
+
These schema files are build using the schema building tool in tools/build-static-schemas/generateStaticSchemas.js, see tools/build-static-schemas/Readme.md
|
|
128
|
+
|
|
127
129
|
#### Configuration typescript types
|
|
128
130
|
|
|
129
131
|
The `SigmetConfig` and `AirmetConfig` types can be found in `libs/sigmet-airmet/src/lib/types.ts` and are leading in defining the configuration files.
|
|
130
132
|
|
|
131
133
|
#### Add a new configuration key
|
|
132
134
|
|
|
133
|
-
Follow these steps to add a new key to the configuration file. Make sure to run storybook by `nx storybook sigmet-airmet` to test the validations.
|
|
135
|
+
Follow these steps to add a new key to the configuration file. Make sure to run storybook by `nx storybook sigmet-airmet` to test the validations.
|
|
136
|
+
|
|
137
|
+
**Note: Before being able to see your changes to the validation in storybook, ensure you compile the validation schemas as described in tools/build-static-schemas/Readme.md**
|
|
138
|
+
|
|
139
|
+
In this example, we're going to add a new property called `my_new_config`: an array with strings that is used by sigmet and airmet.
|
|
134
140
|
|
|
135
141
|
1. Since the new prop is used by both sigmet and airmet, we want to add it to the `FIRArea` typescript type. Inside `libs/sigmet-airmet/src/lib/types.ts` add the following:
|
|
136
142
|
|
|
@@ -144,7 +150,7 @@ export type FIRArea = {
|
|
|
144
150
|
|
|
145
151
|
If you now run `nx typecheck sigmet-airmet` it will fail, and that's expected as we added a new required prop but we have not added it to our configs. We will fix this later
|
|
146
152
|
|
|
147
|
-
2. Add the new validation to the schema. This validation should check for an empty array and if the array is filled with a string. Inside `
|
|
153
|
+
2. Add the new validation to the schema. This validation should check for an empty array and if the array is filled with a string. Inside `tools/build-static-schemas/firArea.schema.json` under `properties` register the new prop `my_new_config` property.
|
|
148
154
|
|
|
149
155
|
```
|
|
150
156
|
"my_new_config": {
|
|
@@ -166,7 +172,7 @@ If you now run `nx typecheck sigmet-airmet` it will fail, and that's expected as
|
|
|
166
172
|
],
|
|
167
173
|
```
|
|
168
174
|
|
|
169
|
-
2.2 Time to test out the validations. First airmet, go to http://localhost:4400/?path=/story/demo-airmet--airmet-dialog-demo. We expect there to be an error since you added a new required property but the story is still working. The same goes for sigmet http://localhost:4400/?path=/story/demo-sigmet--sigmet-dialog-demo. This is because we are merging the firArea scheme, but this overwrites the required list. To fix this, open `
|
|
175
|
+
2.2 Time to test out the validations. First airmet, go to http://localhost:4400/?path=/story/demo-airmet--airmet-dialog-demo. We expect there to be an error since you added a new required property but the story is still working. The same goes for sigmet http://localhost:4400/?path=/story/demo-sigmet--sigmet-dialog-demo. This is because we are merging the firArea scheme, but this overwrites the required list. To fix this, open `tools/build-static-schemas/sigmet.schema.json` and add `my_new_config` to the required prop in the `fir_areas` key. Do the same in `tools/build-static-schemas/airmet.schema.json` Afterwards an error should show for both.
|
|
170
176
|
|
|
171
177
|
```
|
|
172
178
|
"required": [
|