- Jun 01, 2017
-
-
Philippe Pepiot authored
TODO: 1. plug with pyramid authentication 2. This require a patch in cubicweb.pyramid.core._cw_cnx raise cubicweb.Unauthorized when request.cw_session is None
-
- May 30, 2017
-
-
Denis Laxalde authored
In many cases, such errors would occur for an internal reason not because of an invalid request. So prefer "500 Internal Server Error" over "400 Bad Request" which might be misleading if the error is actually "internal". Later on, we should make a proper distinction between true internal errors and *currently unhandled* client errors. One such case concerns converting TypeResolverException that might occur when setting a relation to a bad target into a proper Bad Request (hence the "TODO" in respective test).
-
Denis Laxalde authored
As demonstrated in test, this might occur if an exception with no message is raised (str(exc) == '').
-
- May 31, 2017
-
-
Denis Laxalde authored
-
Denis Laxalde authored
Since "entities" and "schema" resource trees have the same structure, keeping both induces some duplication. We use "entities" resource in schema API views (where "schema" resources were previously used) and adjust a few things here and there to keep things working: * the "described_resource" link between entities and schema resource is no more needed in "links" appobjects since we only have the "entities" resource there now; * similarly the "described_by" link (reverse of "described_resource") is no more needed. Rename the route for schema into "cubicweb-jsonschema.schema" to make it consistent with entities route (named "cubicweb-jsonschema.entities").
-
Denis Laxalde authored
See previous patch for why.
-
Denis Laxalde authored
By using this method and the entity resource, we avoid coupling the view with route name. In tests, lower case the "etype" segment of response Location header as the name of EntityResource is lower case.
-
Denis Laxalde authored
By using RootResource as a factory we can have a single route for all entities view (except for the DELETE view for single entity). We rename the route as "cubicweb-jsonschema.entities" to make it closer to the schema route name.
-
Denis Laxalde authored
We want to have a single route factory for "entities" views, this factory should be RootResource as it matches the first segment of traversal. So add a __getitem__ method to this class to retrieve ETypeResource. This will be used in forthcoming changeset.
-
Frank Bessou authored
-
- May 23, 2017
-
-
Frank Bessou authored
-
- May 31, 2017
-
-
Denis Laxalde authored
Without a network connection, jsonschema validation would fail because external references cannot be retrieved. Issue a warning instead of failing in this case.
-
Denis Laxalde authored
Otherwise pytest collection fails because of migration/postcreate.py which fails to execute outside cubicweb migration environment.
-
Denis Laxalde authored
-
- May 24, 2017
-
-
Denis Laxalde authored
For instance, before this change, the `in_group` relation of a CWUser was not required per generated JSON Schema despite it has a `minItems=1` constraints because the `in_group` property was not listed in "required" constraint of the main document. Update many tests with an incomplete "instance" accordingly.
-
- May 30, 2017
-
-
Denis Laxalde authored
From the code of validation_failed(), "detail" variable might be an empty list so that \n'.join(detail) might be an empty string. When "detail" is empty, do not pass it in kwargs instead. Handle 'invalid-params' key in a similar manner for consistency.
-
- May 29, 2017
-
-
Denis Laxalde authored
This predicates would now match on any class attribute with a name usable for `yams_match` predicate.
-
Denis Laxalde authored
Previously (I don't remember why), we used the name of a class (i.e. target_type) in DocumentField initialization for target fields of InlinedRelationMapper. This causes problem when trying to render the schema of the field for such a relation if respective document is not in JSL registry (it might not at this point apparently). By using the class directly we avoid a registry lookup later when schema of the document field is requested. Added a test checking that schema of an inlined relation renders correctly.
-
Denis Laxalde authored
Instead of passing `takefirst=True` to rdef(), we use kwown target type from selection context if there's only one possible target type. If there are more than one possible target types, we set description to None. Otherwise, pass targettype=None to rdef as it's probably a final relation hopefully not ambiguous.
-
- May 18, 2017
-
-
Philippe Pepiot authored
-
Philippe Pepiot authored
-
Philippe Pepiot authored
Switch from jsonapi errors style to RFC 7807 [1] errors. [1] https://tools.ietf.org/html/rfc7807 Closes #17073910
-
- May 23, 2017
-
-
Denis Laxalde authored
-
Denis Laxalde authored
-
Denis Laxalde authored
Split view for requests with ?role=<schema_role> from main schema view for related entity. In the latter export hyper-schema links based on selection context. Extent tests in hypermedia-walkthrough.rst accordingly.
-
- May 22, 2017
-
-
Denis Laxalde authored
-
Denis Laxalde authored
-
Denis Laxalde authored
We drop the specialized version of "collection-item" link and use the latter instead. This way we have correct "href" for rel="item" links of related collection (for instance on the "topics" relation, we have href="/book/<book id>/topics/<topic id>"). Navigation from related collection to related item is now symmetrical to collection/item for entity types. Extend tests in Hypermedia walkthrough accordingly.
-
Denis Laxalde authored
In functional/doctest, we now have to parse the Link header to retrieve the same information but in extended form with Hyper-Schema links.
-
Denis Laxalde authored
Access to jsondiff.symbols.{insert,delete} at runtime sometimes fails in downstream code (maybe because of CubicWeb reload mechanism). To avoid this import symbols explicitly.
-
Denis Laxalde authored
Make it part of public "testing" API.
-
Denis Laxalde authored
Some utilities in this module could be reused outside doctest context.
-
Denis Laxalde authored
Thus drop the "relinfo" argument from serialize method.
-
Denis Laxalde authored
-
Denis Laxalde authored
Define a TargetEntityMapper class and use it in InlinedRelationMapper.serialize() instead of an adapter This new mapper is symmetrical to TargetETypeMapper selected with an *entity* from context. We use in InlinedRelationMapper.serialize() method instead of an adapter: one more step towards cleaner decoupling between adapters and mappers.
-
Denis Laxalde authored
We are about to drop the former and use the latter instead. Keep coverage the same by copying tests.
-
Denis Laxalde authored
I want to get rid of this function which code is duplicated in "relations" method.
-
Denis Laxalde authored
The entity can be found from selection context for "jsonschema.entity" mappers so we should not need it passed in "values" method. Namely, if selected by `etype="<EType>"` we have no entity so `entity is None` and if selected by `entity=<a live entity>` we have an entity. Define an `entity` property on ETypeMapper, that is overridden in EntityMapper.
-
Katia Saurfelt authored
Follow-up on fe5134e5fb37 in which dependency got bumped to 1.7.0, but 1.8.0 is actually required to import pyramid.predicates.
-
Denis Laxalde authored
As done in other methods of the same class for consistency.
-