/* tslint:disable */ /* eslint-disable */ /** * Tandoor * Tandoor API Docs * * The version of the OpenAPI document: 0.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { mapValues } from '../runtime'; import type { BaseUnitEnum } from './BaseUnitEnum'; import { BaseUnitEnumFromJSON, BaseUnitEnumFromJSONTyped, BaseUnitEnumToJSON, BaseUnitEnumToJSONTyped, } from './BaseUnitEnum'; import type { OpenDataUnitTypeEnum } from './OpenDataUnitTypeEnum'; import { OpenDataUnitTypeEnumFromJSON, OpenDataUnitTypeEnumFromJSONTyped, OpenDataUnitTypeEnumToJSON, OpenDataUnitTypeEnumToJSONTyped, } from './OpenDataUnitTypeEnum'; import type { OpenDataVersion } from './OpenDataVersion'; import { OpenDataVersionFromJSON, OpenDataVersionFromJSONTyped, OpenDataVersionToJSON, OpenDataVersionToJSONTyped, } from './OpenDataVersion'; /** * Moves `UniqueValidator`'s from the validation stage to the save stage. * It solves the problem with nested validation for unique fields on update. * * If you want more details, you can read related issues and articles: * https://github.com/beda-software/drf-writable-nested/issues/1 * http://www.django-rest-framework.org/api-guide/validators/#updating-nested-serializers * * Example of usage: * ``` * class Child(models.Model): * field = models.CharField(unique=True) * * * class Parent(models.Model): * child = models.ForeignKey('Child') * * * class ChildSerializer(UniqueFieldsMixin, serializers.ModelSerializer): * class Meta: * model = Child * * * class ParentSerializer(NestedUpdateMixin, serializers.ModelSerializer): * child = ChildSerializer() * * class Meta: * model = Parent * ``` * * Note: `UniqueFieldsMixin` must be applied only on the serializer * which has unique fields. * * Note: When you are using both mixins * (`UniqueFieldsMixin` and `NestedCreateMixin` or `NestedUpdateMixin`) * you should put `UniqueFieldsMixin` ahead. * @export * @interface PatchedOpenDataUnit */ export interface PatchedOpenDataUnit { /** * * @type {number} * @memberof PatchedOpenDataUnit */ id?: number; /** * * @type {OpenDataVersion} * @memberof PatchedOpenDataUnit */ version?: OpenDataVersion; /** * * @type {string} * @memberof PatchedOpenDataUnit */ slug?: string; /** * * @type {string} * @memberof PatchedOpenDataUnit */ name?: string; /** * * @type {string} * @memberof PatchedOpenDataUnit */ pluralName?: string; /** * * @type {BaseUnitEnum} * @memberof PatchedOpenDataUnit */ baseUnit?: BaseUnitEnum; /** * * @type {OpenDataUnitTypeEnum} * @memberof PatchedOpenDataUnit */ type?: OpenDataUnitTypeEnum; /** * * @type {string} * @memberof PatchedOpenDataUnit */ comment?: string; /** * * @type {string} * @memberof PatchedOpenDataUnit */ readonly createdBy?: string; } /** * Check if a given object implements the PatchedOpenDataUnit interface. */ export function instanceOfPatchedOpenDataUnit(value: object): value is PatchedOpenDataUnit { return true; } export function PatchedOpenDataUnitFromJSON(json: any): PatchedOpenDataUnit { return PatchedOpenDataUnitFromJSONTyped(json, false); } export function PatchedOpenDataUnitFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedOpenDataUnit { if (json == null) { return json; } return { 'id': json['id'] == null ? undefined : json['id'], 'version': json['version'] == null ? undefined : OpenDataVersionFromJSON(json['version']), 'slug': json['slug'] == null ? undefined : json['slug'], 'name': json['name'] == null ? undefined : json['name'], 'pluralName': json['plural_name'] == null ? undefined : json['plural_name'], 'baseUnit': json['base_unit'] == null ? undefined : BaseUnitEnumFromJSON(json['base_unit']), 'type': json['type'] == null ? undefined : OpenDataUnitTypeEnumFromJSON(json['type']), 'comment': json['comment'] == null ? undefined : json['comment'], 'createdBy': json['created_by'] == null ? undefined : json['created_by'], }; } export function PatchedOpenDataUnitToJSON(json: any): PatchedOpenDataUnit { return PatchedOpenDataUnitToJSONTyped(json, false); } export function PatchedOpenDataUnitToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { 'id': value['id'], 'version': OpenDataVersionToJSON(value['version']), 'slug': value['slug'], 'name': value['name'], 'plural_name': value['pluralName'], 'base_unit': BaseUnitEnumToJSON(value['baseUnit']), 'type': OpenDataUnitTypeEnumToJSON(value['type']), 'comment': value['comment'], }; }