You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that we merged this PR, which changes how the definitions are used, we need to update our documentation.
There were a few main changes to how definitions work that we need to address:
For the remaining definitions (I also deleted some), they used to just include uiSchema. I added the schema as well, so they now export an object with both the schema and uiSchema.
The naming convention I've followed for all definitions is each one exports an object which is the name of the definition + Config. Example: the currency definition exports an object called currencyConfig. You can verify what each exported object is called by looking at the bottom of each definition file. The exported object returns 2 things: the schema and uiSchema, which are named the same for each definition.
I made all schema and uiSchema functions, whereas before some were functions and some were just objects. This means that the way you use them is slightly different. When they were just objects, you would use them in the config by just listing the name (e.g., for the ssn field (https://github.com/usds/us-forms-system/blob/master/docs/building-a-form/common-definitions.md#social-security-number), after importing the uiSchema at the top of the file, you would call it in the config by writing ssnUI. Now, you need to call it by first referring to the exported object (ssnConfig), calling the schema or uiSchema within it using dot notation (ssnConfig.uiSchema), and then adding parens to the end (ssnConfig.uiSchema()).
Some uiSchema take optional arguments in the function (e.g., ssnConfig.uiSchema optionally takes a title, so if you wanted to change the title from the default you would pass your title to the function like so: ssnConfig.uiSchema('New title')). Not all schema and uiSchema take optional arguments though. You can see which ones do and what their arguments are by referring to the definition files and seeing which functions include an argument in the parens for schema and uiSchema.
For the new documentation, I don't think you need to include the level of detail I included above; that was mainly to make sure it's clear to who will be documenting this! I think just describing that each definition exports an object that includes both schema and uiSchema, and that both schema and uiSchema are functions will be sufficient. Then showing with a code sample how you call those schema and uiSchema for each definition will be useful, and including info on which ones take optional arguments.
Now that we merged this PR, which changes how the definitions are used, we need to update our documentation.
There were a few main changes to how definitions work that we need to address:
uiSchema
. I added theschema
as well, so they now export an object with both theschema
anduiSchema
.Config
. Example: the currency definition exports an object calledcurrencyConfig
. You can verify what each exported object is called by looking at the bottom of each definition file. The exported object returns 2 things: theschema
anduiSchema
, which are named the same for each definition.schema
anduiSchema
functions, whereas before some were functions and some were just objects. This means that the way you use them is slightly different. When they were just objects, you would use them in the config by just listing the name (e.g., for the ssn field (https://github.com/usds/us-forms-system/blob/master/docs/building-a-form/common-definitions.md#social-security-number), after importing theuiSchema
at the top of the file, you would call it in the config by writingssnUI
. Now, you need to call it by first referring to the exported object (ssnConfig
), calling the schema or uiSchema within it using dot notation (ssnConfig.uiSchema
), and then adding parens to the end (ssnConfig.uiSchema()
).uiSchema
take optional arguments in the function (e.g.,ssnConfig.uiSchema
optionally takes a title, so if you wanted to change the title from the default you would pass your title to the function like so:ssnConfig.uiSchema('New title')
). Not allschema
anduiSchema
take optional arguments though. You can see which ones do and what their arguments are by referring to the definition files and seeing which functions include an argument in the parens forschema
anduiSchema
.For the new documentation, I don't think you need to include the level of detail I included above; that was mainly to make sure it's clear to who will be documenting this! I think just describing that each definition exports an object that includes both
schema
anduiSchema
, and that bothschema
anduiSchema
are functions will be sufficient. Then showing with a code sample how you call thoseschema
anduiSchema
for each definition will be useful, and including info on which ones take optional arguments.For an example of how they're all called, you can look at this test branch on the starter-app: https://github.com/usds/us-forms-system-starter-app/compare/test-new-schema-additions-to-usfs?expand=1.
Let me know if there are any questions!
The text was updated successfully, but these errors were encountered: