Skip to content
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

Parsing, Default Manipulation and Validation Discussion #31

Open
egekorkan opened this issue Jun 28, 2024 · 2 comments
Open

Parsing, Default Manipulation and Validation Discussion #31

egekorkan opened this issue Jun 28, 2024 · 2 comments

Comments

@egekorkan
Copy link
Member

In #3 there were discussions on what to do to align "parsing", validation and default manipulation between playground and node-wot. I think there should be one codebase that does all that among Node.js based Thingweb components and we have some work to do towards that. Below are the important remarks from #3:

  • node-wot td parser, in consuming step, corrects user inputs (if readonly is not boolean, it is corrected to boolean) and fills defaults. This can be done by the core package as this is not needed as an external tool
  • We should align the default addition mechanism to use ajv and share the library between playground web and node-wot. A JSON Schema can contain default values already. Anything that needs conditions (if readOnly: false, op has writeproperty) can be programmed on top.
  • td-parser.ts: maybe rename it since it is a serializer as well or split the functionality
  • resolver-interface.ts: not sure whether we actually need this interface used by helpers and thing-model
  • td-helpers.ts: has little functionality, maybe can be moved into node-wot/core
  • Dependencies mentioned in comments there are now resolved
@danielpeintner
Copy link
Member

Find below some aspects how I see ways forward.


  • td-parser.ts: maybe rename it since it is a serializer as well or split the functionality

I think this file should be removed and the functionality should me moved to internal functions in core. It is used in wot-impl.ts only.

Now, simply deprecate functions.

  • resolver-interface.ts: not sure whether we actually need this interface used by helpers and thing-model

Deprecate now, remove later.
Moved already to

interface Resolver {
fetch(uri: string): Promise<unknown>;
}

Maybe needs to be publicly exported so that other can provide resolvers...

  • td-helpers.ts: has little functionality, maybe can be moved into node-wot/core

I agree, should be removed and if needed moved to core.
Now, simply deprecate functions.


Note: in general we should deprecate all classes/function in td-tools and keep them until we publish a major node-wot release version.
Afterwards we no longer need the package td-tools in node-wot.

@danielpeintner
Copy link
Member

Shall we deprecate the entire functionality in the node-wot/td-tools package just like we did for TM?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants