mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 20:28:46 -05:00
servings
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
* Tandoor
|
||||
* Tandoor API Docs
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.0
|
||||
*
|
||||
@@ -13,67 +13,61 @@
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import type { OpenDataCategory } from './OpenDataCategory';
|
||||
import {
|
||||
OpenDataCategory,
|
||||
OpenDataCategoryFromJSON,
|
||||
OpenDataCategoryFromJSONTyped,
|
||||
OpenDataCategoryToJSON,
|
||||
} from './OpenDataCategory';
|
||||
import type { OpenDataFoodProperty } from './OpenDataFoodProperty';
|
||||
import {
|
||||
OpenDataFoodProperty,
|
||||
OpenDataFoodPropertyFromJSON,
|
||||
OpenDataFoodPropertyFromJSONTyped,
|
||||
OpenDataFoodPropertyToJSON,
|
||||
} from './OpenDataFoodProperty';
|
||||
import type { OpenDataUnit } from './OpenDataUnit';
|
||||
import {
|
||||
OpenDataUnit,
|
||||
OpenDataUnitFromJSON,
|
||||
OpenDataUnitFromJSONTyped,
|
||||
OpenDataUnitToJSON,
|
||||
} from './OpenDataUnit';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersion,
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './OpenDataVersion';
|
||||
} from './';
|
||||
|
||||
/**
|
||||
* 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.
|
||||
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 PatchedOpenDataFood
|
||||
*/
|
||||
@@ -182,15 +176,6 @@ export interface PatchedOpenDataFood {
|
||||
readonly createdBy?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedOpenDataFood interface.
|
||||
*/
|
||||
export function instanceOfPatchedOpenDataFood(value: object): boolean {
|
||||
let isInstance = true;
|
||||
|
||||
return isInstance;
|
||||
}
|
||||
|
||||
export function PatchedOpenDataFoodFromJSON(json: any): PatchedOpenDataFood {
|
||||
return PatchedOpenDataFoodFromJSONTyped(json, false);
|
||||
}
|
||||
@@ -248,3 +233,4 @@ export function PatchedOpenDataFoodToJSON(value?: PatchedOpenDataFood | null): a
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user