mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-27 12:45:17 -05:00
chore: file generation cleanup (#1736)
This PR does too many things :(
1. Major refactoring of the dev/scripts and dev/code-generation folders.
Primarily this was removing duplicate code and cleaning up some poorly written code snippets as well as making them more idempotent so then can be re-run over and over again but still maintain the same results. This is working on my machine, but I've been having problems in CI and comparing diffs so running generators in CI will have to wait.
2. Re-Implement using the generated api routes for testing
This was a _huge_ refactor that touched damn near every test file but now we have auto-generated typed routes with inline hints and it's used for nearly every test excluding a few that use classes for better parameterization. This should greatly reduce errors when writing new tests.
3. Minor Perf improvements for the All Recipes endpoint
A. Removed redundant loops
B. Uses orjson to do the encoding directly and returns a byte response instead of relying on the default
jsonable_encoder.
4. Fix some TS type errors that cropped up for seemingly no reason half way through the PR.
See this issue https://github.com/phillipdupuis/pydantic-to-typescript/issues/28
Basically, the generated TS type is not-correct since Pydantic will automatically fill in null fields. The resulting TS type is generated with a ? to indicate it can be null even though we _know_ that i can't be.
This commit is contained in:
@@ -1,16 +1,151 @@
|
||||
# GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
from .recipe import *
|
||||
from .recipe_asset import *
|
||||
from .recipe_bulk_actions import *
|
||||
from .recipe_category import *
|
||||
from .recipe_comments import * # type: ignore
|
||||
from .recipe_image_types import *
|
||||
from .recipe_ingredient import *
|
||||
from .recipe_notes import *
|
||||
from .recipe_nutrition import *
|
||||
from .recipe_scraper import *
|
||||
from .recipe_settings import *
|
||||
from .recipe_share_token import * # type: ignore
|
||||
from .recipe_step import *
|
||||
from .recipe_tool import * # type: ignore
|
||||
from .request_helpers import *
|
||||
# This file is auto-generated by gen_schema_exports.py
|
||||
from .recipe import (
|
||||
CreateRecipe,
|
||||
CreateRecipeBulk,
|
||||
CreateRecipeByUrlBulk,
|
||||
Recipe,
|
||||
RecipeCategory,
|
||||
RecipeCategoryPagination,
|
||||
RecipePagination,
|
||||
RecipePaginationQuery,
|
||||
RecipeSummary,
|
||||
RecipeTag,
|
||||
RecipeTagPagination,
|
||||
RecipeTool,
|
||||
RecipeToolPagination,
|
||||
)
|
||||
from .recipe_asset import RecipeAsset
|
||||
from .recipe_bulk_actions import (
|
||||
AssignCategories,
|
||||
AssignSettings,
|
||||
AssignTags,
|
||||
DeleteRecipes,
|
||||
ExportBase,
|
||||
ExportRecipes,
|
||||
ExportTypes,
|
||||
)
|
||||
from .recipe_category import (
|
||||
CategoryBase,
|
||||
CategoryIn,
|
||||
CategoryOut,
|
||||
CategorySave,
|
||||
RecipeCategoryResponse,
|
||||
RecipeTagResponse,
|
||||
TagBase,
|
||||
TagIn,
|
||||
TagOut,
|
||||
TagSave,
|
||||
)
|
||||
from .recipe_comments import (
|
||||
RecipeCommentCreate,
|
||||
RecipeCommentOut,
|
||||
RecipeCommentPagination,
|
||||
RecipeCommentSave,
|
||||
RecipeCommentUpdate,
|
||||
UserBase,
|
||||
)
|
||||
from .recipe_image_types import RecipeImageTypes
|
||||
from .recipe_ingredient import (
|
||||
CreateIngredientFood,
|
||||
CreateIngredientUnit,
|
||||
IngredientConfidence,
|
||||
IngredientFood,
|
||||
IngredientFoodPagination,
|
||||
IngredientRequest,
|
||||
IngredientsRequest,
|
||||
IngredientUnit,
|
||||
IngredientUnitPagination,
|
||||
MergeFood,
|
||||
MergeUnit,
|
||||
ParsedIngredient,
|
||||
RecipeIngredient,
|
||||
RegisteredParser,
|
||||
SaveIngredientFood,
|
||||
SaveIngredientUnit,
|
||||
UnitFoodBase,
|
||||
)
|
||||
from .recipe_notes import RecipeNote
|
||||
from .recipe_nutrition import Nutrition
|
||||
from .recipe_scraper import ScrapeRecipe, ScrapeRecipeTest
|
||||
from .recipe_settings import RecipeSettings
|
||||
from .recipe_share_token import RecipeShareToken, RecipeShareTokenCreate, RecipeShareTokenSave, RecipeShareTokenSummary
|
||||
from .recipe_step import IngredientReferences, RecipeStep
|
||||
from .recipe_tool import RecipeToolCreate, RecipeToolOut, RecipeToolResponse, RecipeToolSave
|
||||
from .request_helpers import RecipeSlug, RecipeZipTokenResponse, SlugResponse, UpdateImageResponse
|
||||
|
||||
__all__ = [
|
||||
"RecipeToolCreate",
|
||||
"RecipeToolOut",
|
||||
"RecipeToolResponse",
|
||||
"RecipeToolSave",
|
||||
"RecipeAsset",
|
||||
"RecipeSettings",
|
||||
"RecipeShareToken",
|
||||
"RecipeShareTokenCreate",
|
||||
"RecipeShareTokenSave",
|
||||
"RecipeShareTokenSummary",
|
||||
"RecipeSlug",
|
||||
"RecipeZipTokenResponse",
|
||||
"SlugResponse",
|
||||
"UpdateImageResponse",
|
||||
"RecipeNote",
|
||||
"CategoryBase",
|
||||
"CategoryIn",
|
||||
"CategoryOut",
|
||||
"CategorySave",
|
||||
"RecipeCategoryResponse",
|
||||
"RecipeTagResponse",
|
||||
"TagBase",
|
||||
"TagIn",
|
||||
"TagOut",
|
||||
"TagSave",
|
||||
"RecipeCommentCreate",
|
||||
"RecipeCommentOut",
|
||||
"RecipeCommentPagination",
|
||||
"RecipeCommentSave",
|
||||
"RecipeCommentUpdate",
|
||||
"UserBase",
|
||||
"AssignCategories",
|
||||
"AssignSettings",
|
||||
"AssignTags",
|
||||
"DeleteRecipes",
|
||||
"ExportBase",
|
||||
"ExportRecipes",
|
||||
"ExportTypes",
|
||||
"IngredientReferences",
|
||||
"RecipeStep",
|
||||
"RecipeImageTypes",
|
||||
"Nutrition",
|
||||
"CreateIngredientFood",
|
||||
"CreateIngredientUnit",
|
||||
"IngredientConfidence",
|
||||
"IngredientFood",
|
||||
"IngredientFoodPagination",
|
||||
"IngredientRequest",
|
||||
"IngredientUnit",
|
||||
"IngredientUnitPagination",
|
||||
"IngredientsRequest",
|
||||
"MergeFood",
|
||||
"MergeUnit",
|
||||
"ParsedIngredient",
|
||||
"RecipeIngredient",
|
||||
"RegisteredParser",
|
||||
"SaveIngredientFood",
|
||||
"SaveIngredientUnit",
|
||||
"UnitFoodBase",
|
||||
"CreateRecipe",
|
||||
"CreateRecipeBulk",
|
||||
"CreateRecipeByUrlBulk",
|
||||
"Recipe",
|
||||
"RecipeCategory",
|
||||
"RecipeCategoryPagination",
|
||||
"RecipePagination",
|
||||
"RecipePaginationQuery",
|
||||
"RecipeSummary",
|
||||
"RecipeTag",
|
||||
"RecipeTagPagination",
|
||||
"RecipeTool",
|
||||
"RecipeToolPagination",
|
||||
"ScrapeRecipe",
|
||||
"ScrapeRecipeTest",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user