Skip to content

WIP: Switch from schema builder to schema_dsl#2

Open
Haniyya wants to merge 20 commits intomasterfrom
switch-to-dsl
Open

WIP: Switch from schema builder to schema_dsl#2
Haniyya wants to merge 20 commits intomasterfrom
switch-to-dsl

Conversation

@Haniyya
Copy link

@Haniyya Haniyya commented Oct 18, 2019

WIP since im working on the publication of schema_dsl still, so everything here should fail for now.

The basics of it:

  • Removed all the wrapping in context
  • Moved the partial-search functionality to a new class called Resolver
  • Implemented 4 new types for the dsl:
    • email: the email type that was a new method before
    • date_time: The datetime type that was a new method before
    • partial A Type that holds information on partials that should be expanded
    • locals A type that holds locals information for partials. In the rendering process, these are combined with partials to expand them.
  • Added a new renderer that is prepended to schema_dsl s renderer_chain called PartialExpander which recursively expands partials using partial and locals nodes and returns the completed ast for the other renderers to work normally on. Also removes partial and locals nodes afterwards.
  • SchemaTemplates::Base no longer delegates anything to its context because the context is executing the dsl definition and we would have an infinite loop otherwise
  • Integrated default options with SchemaDsls type_defaults functionality
  • Since JSON::SchemaTemplates functionality is activated on require, I added a test renderer that renders the templates while templates functionality is deactivated.

Probably more, will have to look at the diff again 😅

Haniyya and others added 20 commits April 11, 2019 14:36
* Extracted schema finding logic from context to resolver
* Flattened context to be a builder instead of wrapping one
* Added a renderer that expands partials using contexts
* Added Email, Datetime and Partial types and registered them
* Added very simple spec for the renderer.
used when schemas are called directly, i.e. as root schemas.

Thus the context is root.
used as root, i.e. get defaults for the base_object.
are not necessarily provided together, but separately.
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

Successfully merging this pull request may close these issues.

2 participants