Attribute type aliases with Shale::Type.register and Shale::Type.lookup #44
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.
Design
Introduces
Shale::Type.register
andShale::Type.lookup
that theShale::Mapper
uses to map a short symbol alias to a fullShale::Type::Value
subclass.Existing built-in types have been registered with aliases, with the following exceptions:
Shale::Type::Value
- base class, couldn't come up with a good use case why this would be used directly enough to warrant an aliasShale::Type::Complex
- private API, shouldn't be used directly anywayOut of Scope
I left the lookups for the XML/JSON schema compiler and generation alone such that they continue to stamp in the full class name instead of the symbol alias, but can switch those if you'd prefer.
I was going to swap them, but felt that the
name
method returning something like":string"
felt a bit more awkward than the full class name as it would need to have the:
prefix.Resolves #43.