Giter Club home page Giter Club logo

Comments (5)

CodingDoug avatar CodingDoug commented on September 22, 2024

As a followup thought, it would be interesting to see how this could apply to the generated TS library. Could the specification of fields also omit object properties from the returned result type of queries?

from chiselstrike.

BearLemma avatar BearLemma commented on September 22, 2024

Just to clarify, you are talking about CRUD API, aren't you?

from chiselstrike.

CodingDoug avatar CodingDoug commented on September 22, 2024

Yes, just the generated API and not for other routes in general.

from chiselstrike.

BearLemma avatar BearLemma commented on September 22, 2024

Ok. In that case, it sounds fairly easy to do.
One thing though, why do you want the ID to be always present if user doesn't specify it? I know it's sort of a special field, but if user doesn't want it, why send it? πŸ€·β€β™‚οΈ

from chiselstrike.

CodingDoug avatar CodingDoug commented on September 22, 2024

I'd consider it a best practice to always send the ID. After all, a set of results that's completely void of properties would be confusing (even if that's what they asked for) and impossible to know how to compose more URLs to get the full data for individual items if desired.

As a specific example, let's take PUT, which generates an ID. If the developer wishes to not get reflected back to them all the properties that they just specified, they would at least need the ID to get a hold of it later. Not sending it might be a confusing mistake.

from chiselstrike.

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.