mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-08 23:58:15 -05:00
posprocessing hook for DRF
This commit is contained in:
165
vue3/src/openapi/models/OpenDataUnitRequest.ts
Normal file
165
vue3/src/openapi/models/OpenDataUnitRequest.ts
Normal file
@@ -0,0 +1,165 @@
|
||||
/* 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,
|
||||
} from './BaseUnitEnum';
|
||||
import type { OpenDataUnitTypeEnum } from './OpenDataUnitTypeEnum';
|
||||
import {
|
||||
OpenDataUnitTypeEnumFromJSON,
|
||||
OpenDataUnitTypeEnumFromJSONTyped,
|
||||
OpenDataUnitTypeEnumToJSON,
|
||||
} from './OpenDataUnitTypeEnum';
|
||||
import type { OpenDataVersionRequest } from './OpenDataVersionRequest';
|
||||
import {
|
||||
OpenDataVersionRequestFromJSON,
|
||||
OpenDataVersionRequestFromJSONTyped,
|
||||
OpenDataVersionRequestToJSON,
|
||||
} from './OpenDataVersionRequest';
|
||||
|
||||
/**
|
||||
* 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 OpenDataUnitRequest
|
||||
*/
|
||||
export interface OpenDataUnitRequest {
|
||||
/**
|
||||
*
|
||||
* @type {OpenDataVersionRequest}
|
||||
* @memberof OpenDataUnitRequest
|
||||
*/
|
||||
version: OpenDataVersionRequest;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof OpenDataUnitRequest
|
||||
*/
|
||||
slug: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof OpenDataUnitRequest
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof OpenDataUnitRequest
|
||||
*/
|
||||
pluralName?: string;
|
||||
/**
|
||||
*
|
||||
* @type {BaseUnitEnum}
|
||||
* @memberof OpenDataUnitRequest
|
||||
*/
|
||||
baseUnit?: BaseUnitEnum;
|
||||
/**
|
||||
*
|
||||
* @type {OpenDataUnitTypeEnum}
|
||||
* @memberof OpenDataUnitRequest
|
||||
*/
|
||||
type: OpenDataUnitTypeEnum;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof OpenDataUnitRequest
|
||||
*/
|
||||
comment?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the OpenDataUnitRequest interface.
|
||||
*/
|
||||
export function instanceOfOpenDataUnitRequest(value: object): boolean {
|
||||
if (!('version' in value)) return false;
|
||||
if (!('slug' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('type' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function OpenDataUnitRequestFromJSON(json: any): OpenDataUnitRequest {
|
||||
return OpenDataUnitRequestFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function OpenDataUnitRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenDataUnitRequest {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionRequestFromJSON(json['version']),
|
||||
'slug': json['slug'],
|
||||
'name': json['name'],
|
||||
'pluralName': json['plural_name'] == null ? undefined : json['plural_name'],
|
||||
'baseUnit': json['base_unit'] == null ? undefined : BaseUnitEnumFromJSON(json['base_unit']),
|
||||
'type': OpenDataUnitTypeEnumFromJSON(json['type']),
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
export function OpenDataUnitRequestToJSON(value?: OpenDataUnitRequest | null): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionRequestToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'name': value['name'],
|
||||
'plural_name': value['pluralName'],
|
||||
'base_unit': BaseUnitEnumToJSON(value['baseUnit']),
|
||||
'type': OpenDataUnitTypeEnumToJSON(value['type']),
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user