loopback-datasource-juggler/test
ebarault cfd3cdf535 Overall review of polymorphic relations
In #1298, the spec/doc for polymorphic relations was reviewed

**hasX relation**
- `type`: **hasMany**
- `as`: redefines **this** relation's name (optional)
- `model`: **modelTo**
- `polymorphic`:
  - typeOf `polymorphic` === `String`
    - matching **belongsTo** relation name
      - `foreignKey` is generated as `polymorphic + 'Id'`,
      - `discriminator` is generated as `polymorphic + 'Type'`
  - typeOf `polymorphic` === `Object`
    - `as`: **DEPRECATED** should display a warning,
            replaced by `selector`
    - `selector`: should match **belongsTo** relation name if the
                  latter is defined with {polymorphic: true}
      - (required) if both foreignKey and discriminator
        are **NOT** provided
      - (extraneous) if both foreignKey and discriminator
        are provided
    - `foreignKey`:  A property of modelTo, representing the fk to
       modelFrom's id.
      - generated by default as `selector + 'Id'`
    - `discriminator`: A property of modelTo, representing the actual
                       modelFrom to be looked up and defined
                       dynamically
      - generated by default as `selector + 'Type'`

---

**belongsTo relation**
- `type`: **belongsTo**
- `as`: redefines **this** relation's name (optional)
- `model`: **NOT EXPECTED**: should throw an error at
               relation validation
- `polymorphic`:
  - typeOf `polymorphic` === `Boolean`
      - `foreignKey` is generated as `relationName + 'Id'`,
      - `discriminator` is generated as `relationName + 'Type'`
  - typeOf `polymorphic` === `Object`
    - `as`: **DEPRECATED**: should display a warning,
            replaced by `selector`
    - `selector`:
      - (required) if both foreignKey and discriminator
        are **NOT** provided
      - (extraneous) if both foreignKey and discriminator
        are provided
    - `foreignKey`: A property of modelTo, representing the fk to
                    modelFrom's id.
      - generated by default as `selector + 'Id'`
    - `discriminator`: A property of modelTo, representing the actual
                       modelFrom to be looked up and defined
                       dynamically
      - generated by default as `selector + 'Type'`
2017-05-12 21:33:39 +02:00
..
fixtures/loopback-connector-throwing Fix datasource to report connector-loading errors 2017-02-03 20:29:11 +01:00
helpers Add test support for Cassandra connector 2017-04-07 11:10:47 -07:00
kvao Add missing return for KVAO delete all 2017-01-13 00:19:10 -08:00
operation-hooks.suite Upgrade eslint-config, fix new violations 2017-02-01 12:45:56 +01:00
CustomTypeForeignKey.test.js Fix manually 2016-08-22 19:20:12 -04:00
allow-extended-operators.test.js Refactor logic of options.allowExtendedOperators 2017-01-30 00:05:56 +01:00
async-observer.test.js Fix manually 2016-08-22 19:20:12 -04:00
basic-querying.test.js create sequence for nosql id (#1354) 2017-05-02 13:35:57 -04:00
common.batch.js Fix manually 2016-08-22 19:20:12 -04:00
common_test.js Upgrade eslint-config to 7.x 2017-01-06 13:33:54 +01:00
crud-with-options.test.js Fix block padding 2016-12-13 16:05:50 -08:00
datasource.test.js Fix datasource to report connector-loading errors 2017-02-03 20:29:11 +01:00
datatype.test.js datatype.test: use predefined date 2017-04-28 15:40:19 -04:00
date-string.test.js Add DateString type 2017-05-01 12:28:59 -04:00
default-scope.test.js override collection name for arangodb (#1243) 2017-03-20 09:01:16 -04:00
defaults.test.js Fix block padding 2016-12-13 16:05:50 -08:00
discovery.test.js Fix eslint errors reported by the latest eslint 2016-12-20 17:37:54 +01:00
geo.test.js handle deep geo-near queries (#1314) 2017-04-13 17:05:05 -04:00
hooks.test.js Fix block padding 2016-12-13 16:05:50 -08:00
include.test.js Included models from include operations do not change defined `strict` model option (#1259) 2017-03-20 19:48:57 -04:00
include_util.test.js Fix manually 2016-08-22 19:20:12 -04:00
init.js Add test case for all connectors 2017-02-14 14:01:44 -05:00
introspection.test.js Fix block padding 2016-12-13 16:05:50 -08:00
json.test.js Upgrade eslint & config to latest 2016-12-05 15:14:09 +01:00
kv-memory.js Refactor flush to deleteAll 2017-01-09 14:53:34 -08:00
kvao.suite.js test/kvao: add connectorCapabilities options 2016-10-19 11:06:17 +02:00
loopback-data.test.js Fix manually 2016-08-22 19:20:12 -04:00
loopback-dl.test.js Overall review of polymorphic relations 2017-05-12 21:33:39 +02:00
manipulation.test.js Fix assertion errors 2017-05-04 10:38:06 -04:00
memory.test.js Use dataSource.connect to avoid duplicate connects 2017-04-04 10:19:58 -07:00
mixins.test.js Fix block padding 2016-12-13 16:05:50 -08:00
mock-connectors.js Fix manually 2016-08-22 19:20:12 -04:00
model-definition.test.js configurable model merge 2017-05-10 02:33:45 +02:00
model-inheritance.test.js configurable model merge 2017-05-10 02:33:45 +02:00
optional-validation.test.js Fix id update error message formatting 2017-02-15 18:26:32 +01:00
performance.coffee Reformat the code 2014-01-24 09:09:53 -08:00
persistence-hooks.suite.js Allow `after save` hook to see count of records changed (#1231) 2017-04-06 12:02:34 -04:00
relations.test.js Overall review of polymorphic relations 2017-05-12 21:33:39 +02:00
schema.test.js Fix block padding 2016-12-13 16:05:50 -08:00
scope.test.js Fix block padding 2016-12-13 16:05:50 -08:00
spec_helper.js Fix manually 2016-08-22 19:20:12 -04:00
test1-schemas.json Reformat the code 2014-01-24 09:09:53 -08:00
test2-schemas.json Reformat the code 2014-01-24 09:09:53 -08:00
transient.test.js Fix block padding 2016-12-13 16:05:50 -08:00
util.test.js configurable model merge 2017-05-10 02:33:45 +02:00
validations.test.js Add caseInsensitive opt to validatesUniquenessOf 2017-05-01 17:26:16 -05:00