Cleanup for Beta-version Client Release#224
Conversation
| /** | ||
| * Parsing functions will convert the an object with string values into a new object with all values properly typed | ||
| * to match the data types from a schema definition. This parsing process will convert values to numbers, booleans, | ||
| * and arrays, as required. String values may also be cleaned up to trim whitespace and match the casing of codeList |
There was a problem hiding this comment.
codeList is a new concept for me. was this term explained anywhere I missed?
There was a problem hiding this comment.
Its just an enum of valid values, I am unclear on how this property name was originally selected.
| return result; | ||
| }, | ||
| }; | ||
| const L = loggerFor(__filename); |
There was a problem hiding this comment.
is a single character variable name really necessary? is that much better or faster or easier to understand/read than logger? of log?
There was a problem hiding this comment.
Inherited code, needs review and likely refactor, not touching in this PR. Only appears added because I removed a layer of nesting in this file.
justincorrigible
left a comment
There was a problem hiding this comment.
aside from the typo comments, the L constant is a no go in my book.
let's discuss it, but I doubt you'll ever convince me single character names are an acceptable idea in the XXI.
| #### Dictionary | ||
| Considers all records for all schemas of the dictionary. | ||
|
|
||
| - ForeignKey |
There was a problem hiding this comment.
is this initial capital on purpose? seems to break the snakeCase pattern, so just double checking
| This package provides tools to parse and validate data based on the schemas in Lectern Dictionaries. | ||
|
|
||
| ## Parsing Data | ||
| Parsing data involves reading string values for fields defined in a Lectern Schema and converting the that value into properly typed data. For example, if a field has `"dataType": "number"` and the provided value `"123"` this will be converted from the string value into the numeric `123`. A more complicated example would take a comma separated array value and convert each element and return the final array. If any values cannot be properly parsed and converted based on the schema's rules, an error is returned instead. |
There was a problem hiding this comment.
| Parsing data involves reading string values for fields defined in a Lectern Schema and converting the that value into properly typed data. For example, if a field has `"dataType": "number"` and the provided value `"123"` this will be converted from the string value into the numeric `123`. A more complicated example would take a comma separated array value and convert each element and return the final array. If any values cannot be properly parsed and converted based on the schema's rules, an error is returned instead. | |
| Parsing data involves reading string values for fields defined in a Lectern Schema and converting the values into properly typed data. For example, if a field has `"dataType": "number"` and the provided value `"123"` this will be converted from the string value into the numeric `123`. A more complicated example would take a comma-separated array value, convert each element, and return the final array. If any values cannot be properly parsed and converted based on the schema's rules, an error is returned instead. |
postponing the L fixup for a later PR
| | [Lectern Server](apps/server/README.md) | @overture-stack/lectern-server | apps/server/ | [](https://github.com/overture-stack/lectern/pkgs/container/lectern) | Lectern Server web application. | | ||
| | [Lectern Client](packages/client/README.md) | @overture-stack/lectern-client | packages/client | [](https://www.npmjs.com/package/@overture-stack/lectern-client) | TypeScript Client to interact with Lectern Server and Lectern data dictionaries. This library provides a REST client to assist in fetching data from the Lectern server. It also exposes the functionality from the Lectern Validation library to use a Lectern data dictionary to validate data. | | ||
| | [Lectern Dictionary](packages/dictionary/README.md) | | @overture-stack/lectern-dictionary | [](https://www.npmjs.com/package/@overture-stack/lectern-dictionary) | Dictionary meta-schema definition, includes TS types, and Zod schemas. This also exports all utilities for getting the diff of two dictionaries. | | ||
| | [Lectern Validation](packages/validation/README.md) | @overture-stack/lectern-validation | packages/validation/ | [](https://www.npmjs.com/package/@overture-stack/lectern-client) | Validate data using Lectern Dictionaries. | |
There was a problem hiding this comment.
Lectern Validation badge URL is pointing to other package, should be something linke @overture-stack/lectern-validation
| [<img hspace="5" src="https://img.shields.io/badge/License-AGPL--3.0-blue?style=for-the-badge">](https://github.com/overture-stack/lectern/blob/develop/LICENSE) | ||
|
|
||
| Lectern Server is the standalone web service for Lectern. It provides an API to create, manage, and share Data Dictionary schemas. | ||
| Lectern Server is a standalone web service that provides an REST API to manage and share Data Dictionary schemas. |
There was a problem hiding this comment.
Typo on an REST API, should be a
| | [Lectern Dictionary](packages/dictionary/README.md) | | @overture-stack/lectern-dictionary | [](https://www.npmjs.com/package/@overture-stack/lectern-dictionary) | Dictionary meta-schema definition, includes TS types, and Zod schemas. This also exports all utilities for getting the diff of two dictionaries. | | ||
| | [Lectern Validation](packages/validation/README.md) | @overture-stack/lectern-validation | packages/validation/ | [](https://www.npmjs.com/package/@overture-stack/lectern-client) | Validate data using Lectern Dictionaries. | | ||
|
|
||
| ## Developer Instructions |
There was a problem hiding this comment.
On Developer Instructions section the command to build the server using nx should use the full package name, for instance pnpm nx build @overture-stack/lectern-server
| * The available processing functions are concerned with data at different scales: | ||
| * - processRecord: will process a single data record using schema definition | ||
| * - processSchema: will process a collection of data records using a single schema definition | ||
| * - processDicitonary: will process multiple collecitons of data records, each vs a different |
There was a problem hiding this comment.
There is a typo on processDicitonary.
| * Parse and then validate each record in the list. If there are errors found during conversion, | ||
| * those errors will be returned and validation will be skipped. The final result will indicate if the | ||
| * data processing attempt was successful, or failed due to errors during parsing or validation. |
There was a problem hiding this comment.
This description is right, but the params doesn't match what this function is expecting
There was a problem hiding this comment.
nice catch... ive started removing the param and return annotations from tsdocs for this reason. let TS manage the types, and just have the comment blocks be descriptive.
| > This may not be the module you are looking to import. | ||
| > | ||
| > This is a sub-module used as a dependency by both the [Lectern Client](https://www.npmjs.com/package/@overture-stack/lectern-client) and [Lectern Server](https://github.com/overture-stack/lectern/blob/develop/apps/server/README.md). | ||
| > | ||
| > If you are building an application that will interact with a Lectern Server over HTTP, or wants to validate data using a Lectern Dictionary, you likely want to import the [Lectern Client](https://www.npmjs.com/package/@overture-stack/lectern-client). |
There was a problem hiding this comment.
I appreciate this clarification on submodules packages. 💯
| There are four separate parsing functions exported, mapping to different collections of data to be processed together: | ||
|
|
||
| - `parseFieldValue`: Parse a string value for an individual field. | ||
| - `parseRecordValues`: Parse all fields in an [UnprocessedDataRecord](https://github.com/overture-stack/lectern/blob/develop/docs/important-concepts.md#datarecord-and-unprocesseddatarecord) based on a schema definition. Applies `parseFieldValue` to each field. |
There was a problem hiding this comment.
This link is pointing to a nonexistent word or WIP glossary.
leoraba
left a comment
There was a problem hiding this comment.
Well documented I left some comments on some typos. That aside, everything else is excellent.
2.0.0-beta.1processvalidateandparserespectivelyrest