- 15 Mar, 2018 4 commits
-
-
Denis Laxalde authored
-
Denis Laxalde authored
-
Denis Laxalde authored
These use IJSONSchema adapter (which we want to get rid of) and are redundant with other tests.
-
Denis Laxalde authored
-
- 09 Mar, 2018 2 commits
-
-
Denis Laxalde authored
-
Denis Laxalde authored
-
- 01 Mar, 2018 3 commits
-
-
Denis Laxalde authored
As noted inline in the comment, after commit() we have not real guarantee that the relation we think has been inserted is actually there (though it should be in most cases). For instance, hooks may have modified data before the commit (case happen in client application). In such cases, resource traversal from RelatedEntitiesResource (using __getitem__) would fail with a KeyError so we cannot simply return a 201 Created. We instead return a 204 No Content as we have nothing to return.
-
Denis Laxalde authored
-
Denis Laxalde authored
This is equivalent and just got left-over from prior refactorings.
-
- 28 Feb, 2018 1 commit
-
-
Denis Laxalde authored
We add an in_state (type: "string") property in the JSON instance and schema of workflowable entity type. This property is read-only as it does not match the underlying Yams schema (in which the target of "in_state" relation is a State entity). This is not a problem since we already have a way to manipulate the workflow state of entities through the dedicated "tag:cubicweb.org,2017:workflow-transitions" hyper-link. Closes #17135800.
-
- 01 Mar, 2018 1 commit
-
-
Denis Laxalde authored
Function find_relationship receives a "role" parameter but during the loop on relation definitions we were overriding it with an eponymous variable. Hence change loop variable name into "current_role". This got unnoticed because, most of the times, "role" from parameter and from loop would be the same. But for symmetric relation (an entity type being allowed as both subject and object), this breaks.
-
- 01 Feb, 2018 2 commits
-
-
Denis Laxalde authored
-
Denis Laxalde authored
-
- 29 Jan, 2018 2 commits
-
-
Denis Laxalde authored
Apart from resolving merge conflict, the CompoundMapperTC:test_object_relation test had to be almost entirely rewritten because tests' schema changed in "default" branch ("author" relation semantics changed in cdff71d0dd27, we thus now use "in_library" instead) and because the rendering of array items is now different (items are objects with a "id" property instead of plain strings previously).
-
Denis Laxalde authored
This will be useful on readthedocs.
-
- 26 Jan, 2018 1 commit
-
-
Denis Laxalde authored
--HG-- branch : 0.2
-
- 15 Jan, 2018 1 commit
-
-
Denis Laxalde authored
-
- 12 Dec, 2017 8 commits
-
-
Denis Laxalde authored
This makes it match with previous change on POST handler of related entities resource which accepts a single target resource. We add an extra subclass NonInlinedRelatedCollectionMapper of RelatedCollectionMapper which is selected when the relation is not composite (whereas the latter is). In each of these classes, we override the _submission_schema_and_definitions method so as to either return the creation schema of a plain entity (case of a composite relation) or return a schema (still of type="object") with restriction on the "id" property to only allow *unrelated* targets.
-
Denis Laxalde authored
We extract out the logic for submissionSchema generation from schema_and_definitions() method into a _submission_schema_and_definitions() method because we'll need to override it in subclasses.
-
Denis Laxalde authored
We are about to change the schema produced by 'jsonschema.collection' mapper in the context of a relation but we are missing test coverage for the case where the relation is "inlined" (e.g. the target is component of the relation).
-
Denis Laxalde authored
-
Denis Laxalde authored
As we now only handle POST-ing single resource's representation, we can return the created resource instead of 204 No Content. The location of the created resource corresponds to the related entity, not the primary URL of the entity.
-
Denis Laxalde authored
This will allow to GET /<etype>/<eid>/reverse-<rtype>/<eid> routes. The "reverse-" prefix is handled in traversal by setting the __name__ of RelatedEntityResource according to specified role. Test coverage comes in following changesets as we have no unit tests for "resources".
-
Denis Laxalde authored
-
Denis Laxalde authored
These "related" routes (`/<etype>/<eid>/<rtype>`) actually represent collections of (related) entities. However, JSON Hyper Schema recommends that POST-ing to a collection should be made with a single resource (i.e. an item to be added to the collection). Previously these routes accepted an array of items so we here change this so that it accepts a single resource.
-
- 11 Dec, 2017 4 commits
-
-
Denis Laxalde authored
As there exists no standard relation type to describe "workflow transitions", we use a custom tag: URI scheme as recommended by JSON Hyper Schema specification.
-
Denis Laxalde authored
This simplifies the setup a bit as we do not have to retrieve CWGroup choices as before to create a CWUser.
-
Denis Laxalde authored
This will be used to work with workflows in a simpler way than CWUser entity type which schema is a lot more complex.
-
Denis Laxalde authored
We always use `indent=2` (even for the diff output) and use `sort_keys` option of json.dumps(). In test_json_body_differ we have to work around a difference in json.dumps() between Python 2 and Python 3 as the former apparently yields trailing whitespaces sometimes.
-
- 08 Dec, 2017 3 commits
-
-
Denis Laxalde authored
Introduce a DOCTESTS_PATTERN environment variable to select .rst files to be added as doctests. I could not find another way to make this possible.
-
Denis Laxalde authored
-
Denis Laxalde authored
This relies on a collect_links() method which has been dropped in 819b57b21a50. Given this is not covered by test, better remove that code.
-
- 11 Dec, 2017 1 commit
-
-
Denis Laxalde authored
We associate the proper 'jsonschema.collection' mapper from the WorkflowTransitionsResource resource by implementing the mapper() method. Most added views are straightforward except the post_entity_workflow_transition which handles adapter.fire_transition() call directly (instead of passing through mapper.values()) since, as noted in previous changeset we diverge from the actual implementation of workflows in CubicWeb to expose a simpler REST API. See functional tests for how it works.
-
- 06 Dec, 2017 1 commit
-
-
Denis Laxalde authored
-
- 08 Dec, 2017 1 commit
-
-
Denis Laxalde authored
We add two mappers corresponding to the TrInfo entity type: * TrInfoEntityMapper is used for JSON Schema generation with "creation" role; this schema is different from what the normal mapper would produce in that it exposes the "name" of the transition directly and hides the implementation details of CubicWeb's workflows (which is a state machine not really needed in the framework of a REST API). * TrInfoCollectionMapper is a collection mapper that only supports serialization and produces the array of transitions fired for the entity given in context.
-
- 07 Dec, 2017 1 commit
-
-
Denis Laxalde authored
I.e. do not assume that all mappers will also register some Link appobjects with the same regid.
-
- 06 Dec, 2017 4 commits
-
-
Denis Laxalde authored
-
Denis Laxalde authored
As in previous patch, we delegate this to 'jsonschema.entity' mapper.
-
Denis Laxalde authored
-
Denis Laxalde authored
This is in preparation of always using the same mapper (i.e. 'jsonschema.collection') for an entity collection resource (ETypeResource). We need to preserve the previous behavior for RelatedCollectionMapper that inherits from EntityCollectionMapper, so we factor out the '"type": "array"' schema into an _array_schema() method.
-