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

Output content #8

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

Output content #8

wants to merge 22 commits into from

Conversation

terazus
Copy link
Collaborator

@terazus terazus commented Dec 7, 2021

PATCH NOTE:
This should be the final code commit. It contains several changes:

  • Added a VERBOSE variable that controls if the script should be silent or not.
  • Move the code to /src/ and renamed test.js to index.js
  • Added npm commands:
    1. npm run exec:verbose to get the console log
    2. npm run exec or npm run exec:silent to prevent console.logs
    3. The verbosity is controlled through node's CLI parameters: node src/index.js mode=verbose
  • Refactored the anyOf code by creating a decidated function processAnyOf
  • Added the process of multiples $ref splitting fields (see inputs and outputs of process.json)
  • Output content of the script to /src/output/
  • Removed very long comment

@terazus terazus requested review from asishallab and proccaserra and removed request for proccaserra and asishallab December 7, 2021 14:30
@terazus terazus marked this pull request as draft December 7, 2021 14:33
@terazus terazus marked this pull request as ready for review December 7, 2021 14:47
@terazus terazus requested review from asishallab and proccaserra and removed request for asishallab December 7, 2021 14:48
@terazus terazus removed the request for review from proccaserra December 7, 2021 14:48
@terazus terazus marked this pull request as draft December 7, 2021 14:48
@terazus terazus marked this pull request as ready for review December 7, 2021 14:50
Copy link
Collaborator

@proccaserra proccaserra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @terazus. I only have a question about a zendro key spelling .

Then regarding targetKey, it seems it should be the name of the main object for the given schema appended with "_id" (as far as I can tell but this seems not to be always the case based on the available examples -> more discussions).

@coeit
Copy link
Member

coeit commented Dec 9, 2021

Great work @terazus. I only have a question about a zendro key spelling .

Then regarding targetKey, it seems it should be the name of the main object for the given schema appended with "_id" (as far as I can tell but this seems not to be always the case based on the available examples -> more discussions).

In case we have a one_to_many or many_to_one association Zendro uses different attributes to describe the association:

  • target: points to the name of the associated model (attribute model) in the associated model's definition file
  • targetKey: points to the attribute name of the foreignKey used to store the association. We store that foreignKey on the "many_to_one" end of the association. For example many cities are part of a single country. The city model will have an attribute (we usually call it country_id, but its arbitrary) to store the id of its associated country.
  • keysIn: points to the name of the model that holds the targetKey attribute (in above example that would be city)
  • reverseAssociation The name of the reverse association defined in the associated model's definition file.

In the case of a many_to_many records of both ends of the association will have a field that stores an array with foreignKeys that define the associated records. Here we need an additional attribute sourceKey to store the name of the attribute that stores those foreign keys in the "source" model.

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

Successfully merging this pull request may close these issues.

4 participants