Skip to content

Incorrect edge schema generation in 0.7.0 #114

@volodymyrko

Description

@volodymyrko

Hi
there seems be an issue with generating schema (CollectionBase.schema) for Edges/Relations with custom attributes (like SpecializesIn ) in specific case.
Here are few examples:

  1. when schema method is run for SpecializesIn first (before any other relations) everything is fine
(Pdb) self._graph.edges['specializes_in'].schema().fields.keys()
<class 'tests.data.SpecializesIn'>
dict_keys(['expertise_level', '_key'])   # 'expertise_level' is present

(Pdb) self._graph.edges['studies'].schema().fields.keys()
<class 'arango_orm.collections.Relation'>
dict_keys([])
  1. if schema method is run for Relation first it does not generate correct schema
(Pdb) self._graph.edges['studies'].schema().fields.keys()
<class 'arango_orm.collections.Relation'>
dict_keys([])

(Pdb) self._graph.edges['specializes_in'].schema().fields.keys()
<class 'tests.data.SpecializesIn'>
dict_keys([])  # IS EMPTY

is happens because Relation._cls_schema is already generated/cached at the first step (self._graph.edges['studies'].schema()) and it is used when self._graph.edges['specializes_in'].schema() is run. SpecializesIn is inherited from Relation so it uses Relation._cls_schema data

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions