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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): improve scaffolding of complex model settings #2843

Merged
merged 1 commit into from May 7, 2019

Conversation

Projects
None yet
2 participants
@bajtos
Copy link
Member

commented May 7, 2019

Leverage stringify-object package to convert model settings object into well-formatted TypeScript source code.

An example of a simple settings object:

@model({settings: {strict: false}})
export class MyModel extends Entity {
  // ...
}

A more complex example:

@model({
  settings: {
    annotations: [{destinationClass: 'class1', argument: 0}],
    foreignKeys: {fk_destination: {name: 'fk_destination'}},
    strict: false
  }
})
export class MyModel extends Entity {
  // ...
}

See #2604 /cc @yanamg7

Checklist

馃憠 Read and sign the CLA (Contributor License Agreement) 馃憟

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

馃憠 Check out how to submit a PR 馃憟

@bajtos bajtos added feature CLI labels May 7, 2019

@bajtos bajtos requested review from raymondfeng and nabdelgadir May 7, 2019

@bajtos bajtos self-assigned this May 7, 2019

@nabdelgadir
Copy link
Contributor

left a comment

Thanks for improving this 馃挴

@bajtos bajtos force-pushed the feat/stringify-model-settings branch from 5975e8b to bf360d6 May 7, 2019

feat(cli): improve scaffolding of complex model settings
Leverage stringify-object package to convert model settings object
into well-formatted TypeScript source code.

An example of a simple settings object:

    @model({settings: {strict: false}})
    export class MyModel extends Entity {
      // ...
    }

A more complex example:

    @model({
      settings: {
        annotations: [{destinationClass: 'class1', argument: 0}],
        foreignKeys: {fk_destination: {name: 'fk_destination'}},
        strict: false
      }
    })
    export class MyModel extends Entity {
      // ...
    }

Signed-off-by: Miroslav Bajto拧 <mbajtoss@gmail.com>
Co-Authored-By: yanamg7 <Y.Agapeyev@F5.com>

@bajtos bajtos force-pushed the feat/stringify-model-settings branch from bf360d6 to 68779c6 May 7, 2019

@bajtos bajtos merged commit 5035c63 into master May 7, 2019

2 of 4 checks passed

coverage/coveralls Coverage decreased (-0.006%) to 91.387%
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
clahub All contributors have signed the Contributor License Agreement.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@bajtos bajtos deleted the feat/stringify-model-settings branch May 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.