Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reliance on special properties: _class, _id #1

Open
eduard93 opened this issue Nov 8, 2019 · 2 comments
Open

Reliance on special properties: _class, _id #1

eduard93 opened this issue Nov 8, 2019 · 2 comments

Comments

@eduard93
Copy link

eduard93 commented Nov 8, 2019

RESTForms currently relies on _class, and _id properties understand which object do we need to open.

Our goal is to remove or minimize this reliance.

Possible approaches:

  1. Remove special properties from request body and pass them as url params
  2. Force FORM classes to use %JSONREFERENCE = OID for properties and provide id property. What about child updates in this scenario?

Other ideas?

@isc-afuentes
Copy link

  1. I guess PUT /:form in Form.REST.Object (updateFormClassObject) will have to be removed?
  • I think that if %JSONREFERENCE=OBJECT is used in a create / update operation, new objects will be always created.
  • If %JSONREFERENCE=OID is used, references will be like "relative": "Form.Test.Person,1", which I'm not sure if it's easy to use from a client application (e.g. Angular) because it won't be the object itself but a "pointer".

In the same way Form.Adaptor has a ClassMethod toJSON method called from Form.REST.Object, we could encapsulate in Form.Adaptor all needed CRUD methods and use them from Form.Adaptor. Then we can build UnitTest to test all Form.Adaptor behaviours converting data from/to JSON using %JSON.Adaptor and Form.Test.* classes.

@isc-afuentes
Copy link

Have a look at the pull-request #8

I've just submitted a quick change to support CRUD operations using %JSON.Adaptor:

  • Create: POST /form/object/:class
  • Update: PUT /form/object/:class/:id
  • Read: GET /form/object/:class/:id
  • Delete: DELETE /form/object/:class/:id

(I've removed the former PUT /form/object/:class/:id because its reliance on _id, _class. We can recover this behaviour later if we need it, but maybe this way we can have still a RESTful service)

We can define different %JSON.Adaptor mappings using class parameters FORMCREATEMAPPING, FORMUPDATEMAPPING, FORMREADMAPPING

Unitest available in: UnitTests.ObjectCRUD

henryhamon pushed a commit that referenced this issue Jan 31, 2020
Merge latest henryhamon changes into dev
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

No branches or pull requests

2 participants