-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: protocol buffers, json schema, & types for each #22
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since we're transitioning to using protobufs I've started removed code that's not needed anymore
`protobuf-es` generated a class where each field that is not optional has a default value (i.e. string -> '') which can't be changes. This doesn't seem like a useful way of preventing errors since an empty object is a valid initializer. `ts-proto` generates typescript types and actually enforce type checking and its easy to integrate with `buf` Additionaly ts-proto provides decode and encode functions so maybe wrapping in a class is not necessary anymore?
Also, some formatting from eslint and standard
* Added jsdoc params and return type * Added Observation schema validation generated using typebox
Additionally change buf.slice with buf.subarray since the former is deprecated
each type of observation
I've added json-schema-to-typescript to turn all the schemas to .d.ts files. This replaces typebox use since it seemed easier. Additionally this meant setting the ts-proto opt to turn snake_case fields of protobuf schema to camelCase to false since fields in json schema are snake_case. Jsonschema treats dates as strings with a special format, so every proto field that was a Timestamp now is just a string (for now)
the type of the message i.e. in observation proto we declare inside Observation ``` message Metadata { } ``` to use that field we need to additionaly add that message as a field ``` optional Metadata metadata = 11; ```
set up typedoc, revise npm scripts
This was referenced Jul 28, 2023
This was referenced Aug 15, 2023
This was referenced Sep 15, 2023
This was referenced Sep 28, 2023
This was referenced Oct 25, 2023
This was referenced Aug 1, 2024
This was referenced Aug 24, 2024
This was referenced Sep 2, 2024
This was referenced Sep 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a migration to using protocol buffers as encoding scheme for records in mapeo.
Typescript types are generated from a .proto file for each possible record type (this PR only implements Observation).
Additionally, it exposes an encode and decode functions that validate the records against a json schema.