-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support Cross-Technologies Unit & API Specifications #31
Comments
that would be a great change, currently we're holding a custom LengthDto that allows us to parse to/from out c# unitsnet backend.
the one usage we're currently not doing is actually converting the data from the backend to a UnitsNetJS Currenlty (as far as I see it) a UnitsNetJS Length has no information about the unit it currently is representing, since it always has |
@Shentoza In the meantime, I have opened a discussion angularsen/UnitsNet#1378 with the UnitsNet owner to see his opinion about such a cross-language convention. |
That's awesome. The example implementation in C# is basically what we're currently doing, to support a readable API response from our backend. Once your PR completes, we can remove all the bandaid solutions and almost feel like we're using a cross-technology framework for unit handling |
Implemented by #32 |
@Shentoza After ~ two months of waiting for progress on the UnitNet library discussion, I've decided to merge the changes into the main version. From now on, you can utilize this updated version from both JS #32 & Python (haimkastner/unitsnet-py#18) Regardless of the final decision made in the UnitNet thread, I'll maintain backward compatibility with this merged API. |
As part of the powerful and wide support in multiple languages in the unit definition, I think it will be a good idea to standardize the way how unit is represented in an API spec, and how it will be exposed/loaded.
The API object should look similar to:
And this is also how it will be represented in the OpenAPI specification.
The JSON will look like this:
As part of the full JSON payload something like:
Any unit class will have an API to expose and load it:
See also #29 for motivation
The text was updated successfully, but these errors were encountered: