Giter Site home page Giter Site logo

schemer's People

Contributors

benjaminpritchard avatar bminer avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

schemer's Issues

test coverage for tags

Make a new .GO module called "tag-options_test.go" which contains a test to make sure that Schemer can parse struct tags properly. Have the test include all variations of tags.

cannot decode structures into empty interface

It doesn't appear possible to decode structures into empty interfaces. This might be related to the fact that DefaultGOType() for FixedObjects does not return an appropriate structure. (It currently only returns a blank struct.)

JSON Schema Decoder bugs

  • Fix: bits and length fields should be allowed to be null
  • Fix: field name should be allowed to be a string or an array of strings (currently only array of strings works)

Document custom schema IDs

There is enough room for 64 custom schema IDs. Probably have 0-31 be well-defined types and 32-63 be custom user-defined types

Replace `DecodeSchema` and `DecodeSchemaJSON` with custom Decoder

Replace DecodeSchema and DecodeSchemaJSON with something like NewSchemaDecoder and NewJSONSchemaDecoder.

I'd like to mirror the JSON decoder API to provide a Buffered() method that returns an io.Reader.

  • func (Decoder) Buffered() bufio.Reader
  • func (Decoder) Decode() (Schema, error)

This makes it clearer that the io.Reader is a buffered reader, and it exposes the buffered but unconsumed contents of the Reader.

better test coverage for decoding binary data

It might be a good idea to include some binary schemas and encoded data to use during unit testing. The binary data should be generated by encoding data with Schemer.

Then during unit tests, where changes could potentially be made to encoding / decoding logic, it is important to check the behavior of both the encoding and decoding logic.

On the encoding side, the tests should compare binary data generated with know good binary data.

On the decoding side, the test should make sure the decoder can always decode the known binary data to known values.

Add schemer version to schema

Adding the version number of schemer itself to the encoded schemas will allow even more compatibility as schemer evolves

ParseStructTag should use regular expressions

ParseStructTag() in module tag-options currently uses an ad hoc method to parse the schemer tags on structures. A better approach is to utilize regular expressions to parse the tags.

The syntax of the tags should be checked. Currently I believe they are in the format like this:

tag := (alias)?("," option)*
alias := identifier
"["identifier(","identifier)*"]"
option := "weak", "null", "not null"

An example tag is:
schemer:"readings"

finish example programs

The example programs in the examples directory need finished. Having good examples is important because they illustrate how to use the library, and show why Schemer is useful in a concrete way. Therefore, having them could be helpful to programmers considering using Schemer.

Consider new folder / package layout

  • schemer
    • BoolSchema
    • ...
    • ObjectField
    • Schema
    • SchemaOptions
    • Register
  • schemer/decoder
    • decoder.NewSchemer
    • decoder.NewJSON
    • decoder.SchemaOf
    • decoder.SchemaOfType
  • schemer/util
    • PreEncode
    • PreDecode
    • ReadUvarint
    • WriteUvarint
    • StructTag

javascript interface

A major use case for this library is probably to communicate from a GO server to Browser UI. Therefore, having a java script implementation seems important and worth implementing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.