hubi icon indicating copy to clipboard operation
hubi copied to clipboard

Contexts

Open mvcds opened this issue 6 years ago • 0 comments

A hubi context means that tokens and attributes may yield different generated source files.

There are 4 kinds of contextual changes I can think of: add, delete, change and referential.

Example

Givin a token User, I can think in the following contexts, which exist in different repositories of an App

Back-end

  1. Domain model: Uses Joi Translator to yield user_id, user_name, user_name and user_registred_at attributes
  2. Sequelize model: Uses Sequelize Translator to generate the same attributes as 1
  3. GraphQL type: Uses GrapqQL Translator but renames the tokens attributes in order to not expose my internal database schema, by not using "user_" as a prefix and renaming the token to Custumer

Front-end

  1. Domain model: Uses Joi Translator to yield the same attributes as 3 but also rename the token to Custumer
  2. React component: Translates exactly as the previous point but using PropTypes Translator

Achievement Service

  1. Domain model: Uses Joi Translator to yield user_id attribute, as it is all it needs to send achievements

Why this issue is important

At the moment a translator yields exactly what is described by a domain file.

mvcds avatar Apr 14 '18 13:04 mvcds