• Alex Kalderimis's avatar
    Add resolvers for design-at-version model · 95871e93
    Alex Kalderimis authored
    * Add design-at-version resolution
    
    This adds separate singular and plural resolvers for design-at-version,
    with tests and references in the design-type.
    
    DesignsAtVersionResolver is nested under Version - This reflects the
    fact that this particular resolver requires that it is mounted on a
    version
    
    This also importantly ensures that only singular arguments are passed in
    singular context, and only plural ones in plural context. Mutually
    incompatible arguments are detected and raised as errors.
    
    Equally importantly, this ensures that any objects we fetch by ID have
    to pass the same reference checks as the other ways of resolving them,
    and they must be coherent with  the implicit version context, and
    visible at that version.
    
    Three variants of version resolvers are distinguished:
    
    * when there is no relevant context (e.g. top level):
      - singular resolver able to retrieve versions by ID
    * when there is a relevant context (a source of versions)
      - plural resolver to find all versions up-to a given version
      - singular resolver to find a version by ID or SHA
    
    Resolvers are split up into custom singular versions where this makes
    code simpler.
    
    Single resolvers return self as single form
    
    This introduces a shared context for efficiency
    95871e93
version_resolver_spec.rb 1.12 KB