Giter VIP home page Giter VIP logo

Comments (4)

kjdelisle avatar kjdelisle commented on September 25, 2024 1

@ssh24 What's left for this task:

  • Ensure _.rev is not being altered on any of the remaining CRUD methods. The PR in its current state has replaceOrCreate, updateOrCreate and create covered (with tests). You'll probably need to make sure that all of the find and destroy functions also do the same thing.
  • You'll also need to demonstrate that they work across the REST APIs; that is, it should show the _.rev property in the returned payloads on GET, and should accept (and use) _.rev on POST/PUT/PATCH/DELETE

With respect to the Swagger/OpenAPI definitions, we can go one of two routes:

  1. We inject the _.rev property onto models that use a Cloudant datasource, so that it actually shows up as part of the API def.
  2. We document the need to handle _.rev and put the onus on the user/developer to add this property to their model definitions.

from loopback-connector-cloudant.

bajtos avatar bajtos commented on September 25, 2024

But considering the nature of Cloudant db, we should ask the caller to provide rev, and return error if it's missing.

A big +1 from me.

I believe the field is called _rev in Cloudant, isn't it? https://docs.cloudant.com/mvcc.html#revisions

I am proposing to define a _rev property on a model at the time when the model is attached to a Cloudant datasource. That way the _rev property will be propagated to Swagger too.

The catch is how to tell clients that _rev should not be included in create requests? This is similar to the problem of excluding id property when forceId is true, see strongloop/loopback#2924

from loopback-connector-cloudant.

jannyHou avatar jannyHou commented on September 25, 2024

@bajtos ah sorry I forgot to direct you to #54 (comment), I made some comment about how to let callers access _rev in that link.

The catch is how to tell clients that _rev should not be included in create requests

True, I will look into this part. My suggestion is based on using an option flag to tell function fromDB() returns _rev with data or not, so doesn't have this concern.

from loopback-connector-cloudant.

ssh24 avatar ssh24 commented on September 25, 2024

The feature has been landed and awaiting to be released on the next major version. Closing this ticket as a result.

from loopback-connector-cloudant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.