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

Prefix internal fields #141

Closed
eduardoboucas opened this Issue Sep 16, 2016 · 4 comments

Comments

Projects
2 participants
@eduardoboucas
Copy link
Member

eduardoboucas commented Sep 16, 2016

We could prefix with underscore (or anything) all our internal fields that get appended to documents (e.g. createdAt, createdBy, etc.). This would allow automated systems to easily strip these fields out.

For example, API wrapper could remove internal fields from an update request and therefore avoiding a 400 response.

Also, it would be easier to create a script to export documents from DADI API to another platform, as meta fields could easily be identified and removed from the output.

This is a breaking change, so just leaving the idea here for 2.0.0.

@eduardoboucas

This comment has been minimized.

Copy link
Member Author

eduardoboucas commented Feb 15, 2017

Just leaving a note here that this will be a breaking change for api-wrapper and api-wrapper-core too.

@jimlambie jimlambie removed this from Backlog in API Roadmap May 29, 2017

@jimlambie jimlambie modified the milestones: 3.0.0, 2.0.0 May 31, 2017

@jimlambie jimlambie removed this from Backlog in API Version 2 May 31, 2017

@jimlambie jimlambie added this to Backlog in API Version 3.0 May 31, 2017

@jimlambie

This comment has been minimized.

Copy link
Member

jimlambie commented Jul 7, 2017

As suggested by @fra967 here, an object containing all internal fields may be easier to deal with.

Example

"meta": {
  "createdAt": 145482828828,
  "createdBy": publish,
}
@eduardoboucas

This comment has been minimized.

Copy link
Member Author

eduardoboucas commented Jul 7, 2017

What about _id? It's probably the most widely used internal field and luckily it's already prefixed. If we move all internal fields to a meta object, we'll be causing loads of problems to consumer apps. Can we justify that?

Personally I'd prefer to have the ability to configure the prefix, having _ as the default value.

@jimlambie

This comment has been minimized.

Copy link
Member

jimlambie commented Jul 7, 2017

Ok, sounds fine to me. Each of the data connectors has to handle these internal fields before inserting/updating, as not all databases accept fields with an underscore for a prefix. But that's fine, as we already do that for the identifier anyway.

@eduardoboucas eduardoboucas moved this from Backlog to In Progress in API Version 3.0 Jul 13, 2017

@jimlambie jimlambie moved this from In Progress to Ready for Release in API Version 3.0 Sep 24, 2017

@jimlambie jimlambie closed this Dec 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment