Page Contents

Home > @loopback/repository-json-schema > JsonSchemaOptions > partial

JsonSchemaOptions.partial property

Set this flag to mark all model properties as optional. This is typically used to describe request body of PATCH endpoints. This option will be overridden by the “optional” option if it is set and non-empty.

The flag also applies to nested model instances if its value is set to ‘deep’, such as:


partial?: boolean | 'deep';


class Address {
 street: string;
 city: string;
 state: string;
 zipCode: string;

class Customer {
  address: Address;

// The following schema allows properties of `customer` optional, but not
// `customer.address`
const schemaRef1 = getModelSchemaRef(Customer, {partial: true});

// The following schema allows properties of `customer` and
// `customer.address` optional
const schemaRef2 = getModelSchemaRef(Customer, {partial: 'deep'});