---
lang: en
title: 'API docs: repository.hasonedefinition.polymorphic'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/repository
permalink: /doc/en/lb4/apidocs.repository.hasonedefinition.polymorphic.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [HasOneDefinition](./repository.hasonedefinition.md) &gt; [polymorphic](./repository.hasonedefinition.polymorphic.md)

## HasOneDefinition.polymorphic property

The polymorphism of the target model. The discriminator is a key of source model. If the target model is not polymorphic, then the value should be left undefined or false; If the key on source model indicating the concrete class of the target instance is default i.e. camelCase(classNameOf(throughModelInstance)) + "Id" Then the discriminator field can be undefined

<b>Signature:</b>

```typescript
polymorphic?: boolean | {
        discriminator: string;
    };
```

