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

checklist issue for dpack-1 validation conditions #31

Open
17 tasks
nmushegian opened this issue Feb 11, 2022 · 6 comments
Open
17 tasks

checklist issue for dpack-1 validation conditions #31

nmushegian opened this issue Feb 11, 2022 · 6 comments

Comments

@nmushegian
Copy link
Member

nmushegian commented Feb 11, 2022

isValidType and isValidObject

  • typenames are mixedcase alphanumeric plus underscores
  • typenames start with capital letter
    isValidObject
  • objectnames are mixedcase alphanumeric plus underscores
  • objectnames start with lowercase letter
    isValidPack
  • typenames are equal to the key of the type in types
  • objectnames are equal to the key of the object in objects

isValidPack

  • typenames and objectnames equal the keys used to name the descriptor objects in the pack
  • Has “network”
  • “network” is a string
  • “network” is not “mainnet” (suggest “ethereum”)
  • Has “format”
  • “format” is a string
  • “format” is “dpack-1”
  • Has “objects”
  • “object” is a (JSON) object
  • Has “types”
  • “types” is a (JSON) object
@sambacha
Copy link
Contributor

should there also by a version component to the validation?

@sambacha
Copy link
Contributor

Just to clarify, i am not referring to format/dpack-1 rather a versioning scheme that takes into account direct dependencies of the project (namely typescript and ethers).

@nmushegian
Copy link
Member Author

This issue is for defining well-formed dpack-1 files, for versioning issues related to this particular javascript dpack library please open a separate issue

@sambacha
Copy link
Contributor

sambacha commented Feb 27, 2022

This issue is for defining well-formed dpack-1 files, for versioning issues related to this particular javascript dpack library please open a separate issue

@nmushegian ahh I was inferring from isValidPack to imply that this dpack is usable whereas it is more so this dpack is compliant with the specification, i.e. maybe isCompliantPack may be less ambiguous as to its value of measurement. apologies.

Can we separate out the schema from the current definition location to its own json schema file? we can use regex (patterns in json schema format) to validate + can be listed on https://www.schemastore.org/json/

Here is an example (note this is not actually a proper json schema file just quick example): https://github.com/sambacha/dpack/blob/93cc887459cd3d8dd5b3a63f8958531e19e3995d/spec/dpack-1.schema.json

regex patterns for validation of address and bytecode are provided. Using patterns can do all off the items in isValidType and isValidObject

@nmushegian
Copy link
Member Author

To avoid confusion I think we might just remove schemas altogether and validate each possible error case directly, since a proper spec needs distinct error codes anyway

I think I will use isWellFormed everywhere since that is all that the dpack-1 spec actually is

@sambacha
Copy link
Contributor

To avoid confusion I think we might just remove schemas altogether and validate each possible error case directly, since a proper spec needs distinct error codes anyway

I think I will use isWellFormed everywhere since that is all that the dpack-1 spec actually is

this sounds much better

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