mountaineer 0.4.1.dev2__tar.gz → 0.4.1.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/Cargo.lock +1 -1
  2. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/Cargo.toml +1 -1
  3. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/PKG-INFO +1 -1
  4. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/client_builder/test_build_actions.py +60 -0
  5. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/client_builder/test_build_links.py +45 -0
  6. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/client_builder/build_actions.py +15 -4
  7. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/client_builder/build_links.py +3 -1
  8. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/client_builder/build_schemas.py +4 -25
  9. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/client_builder/openapi.py +20 -27
  10. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/client_builder/typescript.py +58 -4
  11. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/pyproject.toml +1 -1
  12. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.git-blame-ignore-revs +0 -0
  13. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.gitattributes +0 -0
  14. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.github/README_SCRIPTS.md +0 -0
  15. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.github/poetry.lock +0 -0
  16. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.github/pyproject.toml +0 -0
  17. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.github/scripts/__init__.py +0 -0
  18. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.github/scripts/__tests__/test_update_version.py +0 -0
  19. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.github/scripts/check_dependencies.py +0 -0
  20. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.github/scripts/update_version.py +0 -0
  21. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.github/workflows/publish_docs.yml +0 -0
  22. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.github/workflows/test.yml +0 -0
  23. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.github/workflows/validate.yml +0 -0
  24. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/.gitignore +0 -0
  25. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/Dockerfile +0 -0
  26. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/LICENSE +0 -0
  27. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/Makefile +0 -0
  28. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/README.md +0 -0
  29. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/benchmarking/README.md +0 -0
  30. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/benchmarking/benchmarking/__init__.py +0 -0
  31. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/benchmarking/benchmarking/simple_render.py +0 -0
  32. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/benchmarking/poetry.lock +0 -0
  33. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/benchmarking/pyproject.toml +0 -0
  34. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/README.md +0 -0
  35. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/__init__.py +0 -0
  36. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/app.py +0 -0
  37. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/cli.py +0 -0
  38. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/config.py +0 -0
  39. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/controllers/__init__.py +0 -0
  40. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/controllers/complex.py +0 -0
  41. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/controllers/detail.py +0 -0
  42. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/controllers/home.py +0 -0
  43. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/controllers/stream.py +0 -0
  44. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/main.py +0 -0
  45. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/views/__init__.py +0 -0
  46. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/views/app/complex/page.tsx +0 -0
  47. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/views/app/detail/page.tsx +0 -0
  48. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/views/app/home/page.tsx +0 -0
  49. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/views/app/main.css +0 -0
  50. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/views/app/stream/page.tsx +0 -0
  51. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/views/package-lock.json +0 -0
  52. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/views/package.json +0 -0
  53. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/views/postcss.config.js +0 -0
  54. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/ci_webapp/views/tailwind.config.js +0 -0
  55. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/poetry.lock +0 -0
  56. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/ci_webapp/pyproject.toml +0 -0
  57. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/README.md +0 -0
  58. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/__init__.py +0 -0
  59. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/__tests__/__init__.py +0 -0
  60. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/__tests__/common.py +0 -0
  61. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/__tests__/test_builder.py +0 -0
  62. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/__tests__/test_cli.py +0 -0
  63. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/__tests__/test_generation.py +0 -0
  64. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/builder.py +0 -0
  65. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/cli.py +0 -0
  66. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/environments/__init__.py +0 -0
  67. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/environments/base.py +0 -0
  68. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/environments/poetry.py +0 -0
  69. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/environments/venv.py +0 -0
  70. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/external.py +0 -0
  71. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/generation.py +0 -0
  72. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/io.py +0 -0
  73. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/.zed/settings.json +0 -0
  74. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/__init__.py +0 -0
  75. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/editor_configs/vim/.vimrc +0 -0
  76. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/editor_configs/vscode/.vscode/settings.json +0 -0
  77. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/editor_configs/zed/pyrightconfig.json +0 -0
  78. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/.env +0 -0
  79. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/.gitignore +0 -0
  80. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/README.md +0 -0
  81. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/__init__.py +0 -0
  82. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/app.py +0 -0
  83. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/cli.py +0 -0
  84. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/config.py +0 -0
  85. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/controllers/__init__.py +0 -0
  86. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/controllers/detail.py +0 -0
  87. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/controllers/home.py +0 -0
  88. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/main.py +0 -0
  89. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/models/__init__.py +0 -0
  90. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/models/detail.py +0 -0
  91. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/views/__init__.py +0 -0
  92. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/views/app/detail/page.tsx +0 -0
  93. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/views/app/home/page.tsx +0 -0
  94. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/views/app/main.css +0 -0
  95. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/views/package.json +0 -0
  96. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/views/postcss.config.js +0 -0
  97. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/[project_name]/views/tailwind.config.js +0 -0
  98. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/docker-compose.yml +0 -0
  99. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/create_mountaineer_app/templates/project/pyproject.toml +0 -0
  100. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/poetry.lock +0 -0
  101. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/create_mountaineer_app/pyproject.toml +0 -0
  102. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/.zed/settings.json +0 -0
  103. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/README.md +0 -0
  104. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/CNAME +0 -0
  105. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/actions.md +0 -0
  106. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/api_exception.md +0 -0
  107. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/app-controller.md +0 -0
  108. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/build_plugins/base.md +0 -0
  109. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/build_plugins/javascript.md +0 -0
  110. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/build_plugins/postcss.md +0 -0
  111. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/cli.md +0 -0
  112. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/config.md +0 -0
  113. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/controller.md +0 -0
  114. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/core_dependencies.md +0 -0
  115. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/database/config.md +0 -0
  116. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/database/dependencies.md +0 -0
  117. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/logging.md +0 -0
  118. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/render.md +0 -0
  119. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/ssr.md +0 -0
  120. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/api/watch_server.md +0 -0
  121. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/client_actions.md +0 -0
  122. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/cma.md +0 -0
  123. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/database.md +0 -0
  124. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/deploy.md +0 -0
  125. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/error_handling.md +0 -0
  126. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/index.md +0 -0
  127. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/internal/core_library.md +0 -0
  128. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/links.md +0 -0
  129. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/media/final_todo_list.png +0 -0
  130. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/media/ide_typehints.png +0 -0
  131. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/media/network_debug.png +0 -0
  132. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/media/server_side_rendering.png +0 -0
  133. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/metadata.md +0 -0
  134. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/postcss.md +0 -0
  135. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/quickstart.md +0 -0
  136. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/static_analysis.md +0 -0
  137. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/structure.md +0 -0
  138. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/stylesheets/extra.css +0 -0
  139. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/docs/views.md +0 -0
  140. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/mkdocs.yml +0 -0
  141. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/overrides/partials/footer.html +0 -0
  142. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/poetry.lock +0 -0
  143. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/docs_website/pyproject.toml +0 -0
  144. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/media/header.png +0 -0
  145. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__init__.py +0 -0
  146. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/__init__.py +0 -0
  147. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/actions/__init__.py +0 -0
  148. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/actions/test_fields.py +0 -0
  149. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/actions/test_passthrough.py +0 -0
  150. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/actions/test_sideeffect.py +0 -0
  151. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/client_builder/__init__.py +0 -0
  152. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/client_builder/test_build_schemas.py +0 -0
  153. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/client_builder/test_builder.py +0 -0
  154. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/client_builder/test_typescript.py +0 -0
  155. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/common.py +0 -0
  156. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/conftest.py +0 -0
  157. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/database/__init__.py +0 -0
  158. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/database/dependencies/__init__.py +0 -0
  159. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/database/dependencies/conftest.py +0 -0
  160. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/database/dependencies/test_core.py +0 -0
  161. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/database/test_config.py +0 -0
  162. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/database/test_sqlmodel.py +0 -0
  163. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/dependencies/__init__.py +0 -0
  164. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/dependencies/test_base.py +0 -0
  165. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/fixtures/__init__.py +0 -0
  166. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/fixtures/complex_controller_ssr_with_react.js +0 -0
  167. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/fixtures/home_controller_source_map.js.map +0 -0
  168. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/fixtures/home_controller_ssr_with_react.js +0 -0
  169. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/js_compiler/__init__.py +0 -0
  170. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/js_compiler/test_javascript.py +0 -0
  171. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/js_compiler/test_postcss.py +0 -0
  172. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/js_compiler/test_source_maps.py +0 -0
  173. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_annotation_helpers.py +0 -0
  174. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_app.py +0 -0
  175. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_cache.py +0 -0
  176. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_cli.py +0 -0
  177. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_config.py +0 -0
  178. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_controller.py +0 -0
  179. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_cropper.py +0 -0
  180. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_exceptions.py +0 -0
  181. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_logging.py +0 -0
  182. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_paths.py +0 -0
  183. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_ssr.py +0 -0
  184. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/__tests__/test_watch.py +0 -0
  185. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/actions/__init__.py +0 -0
  186. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/actions/fields.py +0 -0
  187. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/actions/passthrough.py +0 -0
  188. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/actions/sideeffect.py +0 -0
  189. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/annotation_helpers.py +0 -0
  190. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/app.py +0 -0
  191. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/cache.py +0 -0
  192. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/cli.py +0 -0
  193. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/client_builder/builder.py +0 -0
  194. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/config.py +0 -0
  195. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/constants.py +0 -0
  196. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/controller.py +0 -0
  197. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/controllers/__init__.py +0 -0
  198. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/controllers/exception_controller.py +0 -0
  199. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/cropper.py +0 -0
  200. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/database/__init__.py +0 -0
  201. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/database/cli.py +0 -0
  202. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/database/config.py +0 -0
  203. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/database/dependencies/__init__.py +0 -0
  204. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/database/dependencies/core.py +0 -0
  205. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/database/sqlmodel.py +0 -0
  206. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/database/validator.py +0 -0
  207. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/dependencies/__init__.py +0 -0
  208. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/dependencies/base.py +0 -0
  209. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/dependencies/core/__init__.py +0 -0
  210. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/dependencies/core/core.py +0 -0
  211. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/exceptions.py +0 -0
  212. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/io.py +0 -0
  213. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/js_compiler/__init__.py +0 -0
  214. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/js_compiler/base.py +0 -0
  215. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/js_compiler/exceptions.py +0 -0
  216. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/js_compiler/javascript.py +0 -0
  217. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/js_compiler/postcss.py +0 -0
  218. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/js_compiler/source_maps.py +0 -0
  219. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/logging.py +0 -0
  220. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/paths.py +0 -0
  221. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/py.typed +0 -0
  222. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/render.py +0 -0
  223. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/ssr.py +0 -0
  224. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/static/__init__.py +0 -0
  225. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/static/api.ts +0 -0
  226. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/static/live_reload.ts +0 -0
  227. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/static/ssr_polyfills.js +0 -0
  228. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/test_utilities.py +0 -0
  229. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/views/__init__.py +0 -0
  230. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/views/core/exception/page.tsx +0 -0
  231. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/views/core/layout.tsx +0 -0
  232. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/views/core/main.css +0 -0
  233. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/views/package-lock.json +0 -0
  234. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/views/package.json +0 -0
  235. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/views/postcss.config.js +0 -0
  236. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/views/tailwind.config.js +0 -0
  237. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/watch.py +0 -0
  238. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/watch_server.py +0 -0
  239. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/mountaineer/webservice.py +0 -0
  240. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/poetry.lock +0 -0
  241. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/benches/fixtures/complex_sourcemap_mapping.txt +0 -0
  242. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/benches/fixtures/home_controller_ssr_with_react.js +0 -0
  243. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/benches/fixtures/ssr_polyfill_archive.js +0 -0
  244. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/benches/lexers_benchmark.rs +0 -0
  245. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/benches/source_map_benchmark.rs +0 -0
  246. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/benches/ssr_benchmark.rs +0 -0
  247. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/errors.rs +0 -0
  248. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/lexers.rs +0 -0
  249. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/lib.rs +0 -0
  250. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/logging.rs +0 -0
  251. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/source_map.rs +0 -0
  252. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/ssr.rs +0 -0
  253. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src/timeout.rs +0 -0
  254. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src_go/Cargo.toml +0 -0
  255. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src_go/build.rs +0 -0
  256. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src_go/go/js_build.go +0 -0
  257. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src_go/go.mod +0 -0
  258. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src_go/go.sum +0 -0
  259. {mountaineer-0.4.1.dev2 → mountaineer-0.4.1.dev3}/src_go/src/lib.rs +0 -0
@@ -535,7 +535,7 @@ dependencies = [
535
535
 
536
536
  [[package]]
537
537
  name = "mountaineer"
538
- version = "0.4.1-dev2"
538
+ version = "0.4.1-dev3"
539
539
  dependencies = [
540
540
  "criterion",
541
541
  "deno_core_icudata",
@@ -15,7 +15,7 @@ harness = false
15
15
 
16
16
  [package]
17
17
  name = "mountaineer"
18
- version = "0.4.1-dev2"
18
+ version = "0.4.1-dev3"
19
19
  edition = "2021"
20
20
 
21
21
  [dependencies]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mountaineer
3
- Version: 0.4.1.dev2
3
+ Version: 0.4.1.dev3
4
4
  Requires-Dist: pydantic
5
5
  Requires-Dist: fastapi
6
6
  Requires-Dist: inflection
@@ -1,4 +1,6 @@
1
+ from datetime import datetime
1
2
  from re import sub as re_sub
3
+ from uuid import UUID
2
4
 
3
5
  import pytest
4
6
  from fastapi import APIRouter
@@ -125,6 +127,37 @@ EXAMPLE_RESPONSE_400 = ContentBodyDefinition(
125
127
  "ExampleResponseModel",
126
128
  ],
127
129
  ),
130
+ # No request body parameter
131
+ (
132
+ "my_method_fn",
133
+ "/testing/url",
134
+ ActionDefinition(
135
+ action_type=ActionType.POST,
136
+ summary="",
137
+ operationId="",
138
+ requestBody=None,
139
+ responses={
140
+ "200": EXAMPLE_RESPONSE_200,
141
+ "422": EXAMPLE_RESPONSE_400,
142
+ },
143
+ ),
144
+ (
145
+ """
146
+ export const my_method_fn = (): Promise<ExampleResponseModel> => {
147
+ return __request({
148
+ 'method': 'POST',
149
+ 'url': '/testing/url',
150
+ 'errors': {
151
+ 422: HTTPValidationErrorException
152
+ }
153
+ });
154
+ }
155
+ """
156
+ ),
157
+ [
158
+ "ExampleResponseModel",
159
+ ],
160
+ ),
128
161
  # Path and query parameters
129
162
  (
130
163
  "my_method_fn",
@@ -363,3 +396,30 @@ def test_build_raw_response_action(
363
396
  built_function, build_imports = builder.build_action(url, definition, method_name)
364
397
  assert re_sub(r"\s+", "", built_function) == re_sub(r"\s+", "", expected_function)
365
398
  assert set(build_imports) == set(expected_imports)
399
+
400
+
401
+ AnyType = None | bool | str | int | datetime | UUID
402
+ DictParamItem = dict[str, AnyType]
403
+
404
+
405
+ def test_build_invalid_action_api():
406
+ """
407
+ Ensure that we throw an error if the user has provided a schema payload
408
+ that is technically valid, but doesn't allow typehinting with pydantic. All non-raw
409
+ JSON requests should be Pydantic methods.
410
+
411
+ https://github.com/piercefreeman/mountaineer/issues/94
412
+
413
+ """
414
+
415
+ def fn1(payload: DictParamItem, item_id: str, other_id: str) -> None:
416
+ pass
417
+
418
+ router = APIRouter()
419
+ router.post("/fn1")(fn1)
420
+
421
+ builder = OpenAPIToTypescriptActionConverter()
422
+ openapi_spec = get_openapi(title="", version="", routes=router.routes)
423
+
424
+ with pytest.raises(ValueError):
425
+ builder.convert(openapi_spec)
@@ -1,5 +1,7 @@
1
+ from enum import StrEnum
1
2
  from re import sub as re_sub
2
3
  from typing import Callable
4
+ from uuid import UUID
3
5
 
4
6
  import pytest
5
7
  from fastapi import APIRouter
@@ -20,6 +22,20 @@ def view_endpoint_query_params(query_a: str, query_b: int | None = None):
20
22
  pass
21
23
 
22
24
 
25
+ class RouteType(StrEnum):
26
+ ROUTE_A = "route_a"
27
+ ROUTE_B = "route_b"
28
+
29
+
30
+ def enum_view_url(model_type: RouteType, model_id: UUID):
31
+ """
32
+ Model view paths like /{model_type}/{model_id} where we want a flexible
33
+ string to be captured in the model_type path.
34
+
35
+ """
36
+ pass
37
+
38
+
23
39
  @pytest.mark.parametrize(
24
40
  "url, endpoint, expected_link",
25
41
  [
@@ -98,6 +114,35 @@ def view_endpoint_query_params(query_a: str, query_b: int | None = None):
98
114
  """
99
115
  ),
100
116
  ),
117
+ # Path with enum path variables - we should typehint explicitly
118
+ # as the enum based values
119
+ (
120
+ "/enum_view/{model_type}/{model_id}",
121
+ enum_view_url,
122
+ (
123
+ """
124
+ export const getLink = ({
125
+ model_type,
126
+ model_id
127
+ }:{
128
+ model_type: 'route_a' | 'route_b',
129
+ model_id: string
130
+ }) => {
131
+ const url = `/enum_view/{model_type}/{model_id}`;
132
+ const queryParameters: Record<string,any> = {};
133
+ const pathParameters: Record<string,any> = {
134
+ model_type,
135
+ model_id
136
+ };
137
+ return __getLink({
138
+ rawUrl: url,
139
+ queryParameters,
140
+ pathParameters
141
+ });
142
+ };
143
+ """
144
+ ),
145
+ ),
101
146
  ],
102
147
  )
103
148
  def test_convert(url: str, endpoint: Callable, expected_link: str):
@@ -204,12 +204,16 @@ class OpenAPIToTypescriptActionConverter:
204
204
  if not action.is_raw_response:
205
205
  response_types.append(
206
206
  self.get_typescript_name_from_content_definition(
207
- response_definition.content_schema
207
+ response_definition.content_schema,
208
+ url=url,
209
+ status_code=status_int,
208
210
  )
209
211
  )
210
212
  else:
211
213
  error_typehint = self.get_typescript_name_from_content_definition(
212
- response_definition.content_schema
214
+ response_definition.content_schema,
215
+ url=url,
216
+ status_code=status_int,
213
217
  )
214
218
  common_params["errors"][status_int] = TSLiteral(
215
219
  # Provide a mapping to the error class
@@ -253,11 +257,18 @@ class OpenAPIToTypescriptActionConverter:
253
257
  return method_names
254
258
 
255
259
  def get_typescript_name_from_content_definition(
256
- self, definition: ContentDefinition
260
+ self,
261
+ definition: ContentDefinition,
262
+ # Url and status are provided for more context about where the error
263
+ # is being thrown. Can pass None if not available.
264
+ url: str | None = None,
265
+ status_code: int | None = None,
257
266
  ):
258
267
  if not definition.schema_ref.ref:
259
268
  raise ValueError(
260
- f"Content definition {definition} does not have a schema reference"
269
+ f"Content definition {definition} does not have a schema reference.\n"
270
+ f"Double check your action definition for {url} with response code {status_code}.\n"
271
+ "Are you typehinting your response with a Pydantic BaseModel?"
261
272
  )
262
273
  return definition.schema_ref.ref.split("/")[-1]
263
274
 
@@ -58,7 +58,9 @@ class OpenAPIToTypescriptLinkConverter:
58
58
  }:
59
59
  continue
60
60
 
61
- typehint_key, typehint_value = get_typehint_for_parameter(parameter)
61
+ typehint_key, typehint_value = get_typehint_for_parameter(
62
+ parameter, openapi_spec
63
+ )
62
64
  input_parameters[TSLiteral(parameter.name)] = TSLiteral(parameter.name)
63
65
  typehint_parameters[typehint_key] = typehint_value
64
66
 
@@ -6,12 +6,13 @@ from typing import Any, Dict, Iterator, Type, get_args, get_origin
6
6
  from inflection import camelize
7
7
  from pydantic import BaseModel, create_model
8
8
 
9
- from mountaineer.annotation_helpers import get_value_by_alias, yield_all_subtypes
9
+ from mountaineer.annotation_helpers import yield_all_subtypes
10
10
  from mountaineer.client_builder.openapi import (
11
11
  EmptyAPIProperty,
12
12
  OpenAPIProperty,
13
13
  OpenAPISchema,
14
14
  OpenAPISchemaType,
15
+ resolve_ref,
15
16
  )
16
17
  from mountaineer.client_builder.typescript import (
17
18
  TSLiteral,
@@ -103,7 +104,7 @@ class OpenAPIToTypescriptSchemaConverter:
103
104
  ):
104
105
  yield property
105
106
  if property.ref is not None:
106
- yield from walk_models(self.resolve_ref(property.ref, base))
107
+ yield from walk_models(resolve_ref(property.ref, base))
107
108
  if property.items:
108
109
  yield from walk_models(property.items)
109
110
  if property.anyOf:
@@ -116,28 +117,6 @@ class OpenAPIToTypescriptSchemaConverter:
116
117
 
117
118
  return list(set(walk_models(base)))
118
119
 
119
- def resolve_ref(self, ref: str, base: BaseModel) -> OpenAPIProperty:
120
- """
121
- Resolve a $ref that points to a propery-compliant schema in the same document. If this
122
- ref points somewhere else in the document (that is valid but not a data model) than we
123
- raise a ValueError.
124
-
125
- """
126
- current_obj = base
127
- for part in ref.split("/"):
128
- if part == "#":
129
- current_obj = base
130
- else:
131
- try:
132
- current_obj = get_value_by_alias(current_obj, part)
133
- except AttributeError as e:
134
- raise AttributeError(
135
- f"Invalid $ref, couldn't resolve path: {ref}"
136
- ) from e
137
- if not isinstance(current_obj, OpenAPIProperty):
138
- raise ValueError(f"Resolved $ref is not a valid OpenAPIProperty: {ref}")
139
- return current_obj
140
-
141
120
  def convert_schema_to_interface(
142
121
  self,
143
122
  model: OpenAPIProperty,
@@ -188,7 +167,7 @@ class OpenAPIToTypescriptSchemaConverter:
188
167
  yield f"Array<{' | '.join(array_types)}>"
189
168
  elif prop.ref:
190
169
  yield self.get_typescript_interface_name(
191
- self.resolve_ref(prop.ref, base=base)
170
+ resolve_ref(prop.ref, base=base)
192
171
  )
193
172
  elif prop.items:
194
173
  yield from walk_array_types(prop.items)
@@ -4,6 +4,8 @@ from typing import Any, Optional, Union
4
4
 
5
5
  from pydantic import BaseModel, ConfigDict, Field, model_validator
6
6
 
7
+ from mountaineer.annotation_helpers import get_value_by_alias
8
+
7
9
  #
8
10
  # Enum definitions
9
11
  #
@@ -324,33 +326,24 @@ class OpenAPIDefinition(BaseModel):
324
326
  #
325
327
 
326
328
 
327
- def get_types_from_parameters(schema: OpenAPIProperty | EmptyAPIProperty):
329
+ def resolve_ref(ref: str, base: BaseModel) -> OpenAPIProperty:
328
330
  """
329
- Handle potentially complex types from the parameter schema, like the case
330
- of optional fields.
331
+ Resolve a $ref that points to a propery-compliant schema in the same document. If this
332
+ ref points somewhere else in the document (that is valid but not a data model) than we
333
+ raise a ValueError.
331
334
 
332
335
  """
333
- if isinstance(schema, EmptyAPIProperty):
334
- return "any"
335
-
336
- # Recursively gather all of the types that might be nested
337
- if schema.variable_type:
338
- yield schema.variable_type
339
-
340
- for property in schema.properties.values():
341
- yield from get_types_from_parameters(property)
342
-
343
- if schema.additionalProperties:
344
- yield from get_types_from_parameters(schema.additionalProperties)
345
-
346
- if schema.items:
347
- yield from get_types_from_parameters(schema.items)
348
-
349
- if schema.anyOf:
350
- for one_of in schema.anyOf:
351
- yield from get_types_from_parameters(one_of)
352
-
353
- # We don't expect $ref values in the URL schema, if we do then the parsing
354
- # is likely incorrect
355
- if schema.ref:
356
- raise ValueError(f"Unexpected $ref in URL schema: {schema.ref}")
336
+ current_obj = base
337
+ for part in ref.split("/"):
338
+ if part == "#":
339
+ current_obj = base
340
+ else:
341
+ try:
342
+ current_obj = get_value_by_alias(current_obj, part)
343
+ except AttributeError as e:
344
+ raise AttributeError(
345
+ f"Invalid $ref, couldn't resolve path: {ref}"
346
+ ) from e
347
+ if not isinstance(current_obj, OpenAPIProperty):
348
+ raise ValueError(f"Resolved $ref is not a valid OpenAPIProperty: {ref}")
349
+ return current_obj
@@ -5,10 +5,14 @@ Python definitions.
5
5
  """
6
6
  from typing import Any
7
7
 
8
+ from pydantic import BaseModel
9
+
8
10
  from mountaineer.client_builder.openapi import (
11
+ EmptyAPIProperty,
12
+ OpenAPIProperty,
9
13
  OpenAPISchemaType,
10
14
  URLParameterDefinition,
11
- get_types_from_parameters,
15
+ resolve_ref,
12
16
  )
13
17
 
14
18
 
@@ -85,12 +89,62 @@ def map_openapi_type_to_ts(openapi_type: OpenAPISchemaType):
85
89
  return mapping[openapi_type]
86
90
 
87
91
 
88
- def get_typehint_for_parameter(parameter: URLParameterDefinition):
92
+ def get_types_from_parameters(
93
+ schema: OpenAPIProperty | EmptyAPIProperty, base_openapi_spec: BaseModel | None
94
+ ):
95
+ """
96
+ Handle potentially complex types from the parameter schema, like the case
97
+ of optional fields.
98
+
99
+ """
100
+ if isinstance(schema, EmptyAPIProperty):
101
+ return "any"
102
+
103
+ # Recursively gather all of the types that might be nested
104
+ for property in schema.properties.values():
105
+ yield from get_types_from_parameters(property, base_openapi_spec)
106
+
107
+ if schema.additionalProperties:
108
+ yield from get_types_from_parameters(
109
+ schema.additionalProperties, base_openapi_spec
110
+ )
111
+
112
+ if schema.items:
113
+ yield from get_types_from_parameters(schema.items, base_openapi_spec)
114
+
115
+ if schema.anyOf:
116
+ for one_of in schema.anyOf:
117
+ yield from get_types_from_parameters(one_of, base_openapi_spec)
118
+
119
+ # Mutually exclusive definitions
120
+ if schema.enum:
121
+ yield " | ".join([f"'{enum_value}'" for enum_value in schema.enum])
122
+ elif schema.variable_type:
123
+ yield map_openapi_type_to_ts(schema.variable_type)
124
+
125
+ # If we're able to resolve the ref, do so. Some clients call this to get a limited
126
+ # scope of known parameters, so this value is optional.
127
+ if schema.ref:
128
+ if base_openapi_spec:
129
+ ref = resolve_ref(schema.ref, base_openapi_spec)
130
+ yield from get_types_from_parameters(ref, base_openapi_spec)
131
+ else:
132
+ raise ValueError(
133
+ f"Unexpected $ref in schema: {schema.ref}, no base schema passed for resolution"
134
+ )
135
+
136
+
137
+ def get_typehint_for_parameter(
138
+ parameter: URLParameterDefinition, base: BaseModel | None = None
139
+ ):
89
140
  """
90
141
  Get the typehint for a parameter, which may be a single type or a union of types.
91
142
 
143
+ Providing the "base" OpenAPI schema allows us to resolve refs. Otherwise we will just
144
+ parse the types directly from the parameter and throw an error on ref resolution.
145
+
92
146
  """
93
- parameter_types = set(get_types_from_parameters(parameter.schema_ref))
147
+ parameter_types = set(get_types_from_parameters(parameter.schema_ref, base))
94
148
 
95
149
  key = TSLiteral(parameter.name) + (
96
150
  TSLiteral("?") if not parameter.required else TSLiteral("")
@@ -98,7 +152,7 @@ def get_typehint_for_parameter(parameter: URLParameterDefinition):
98
152
  value = TSLiteral(
99
153
  " | ".join(
100
154
  # Sort helps with consistency of generated code
101
- sorted([map_openapi_type_to_ts(raw_type) for raw_type in parameter_types])
155
+ sorted(parameter_types)
102
156
  )
103
157
  )
104
158
 
@@ -9,7 +9,7 @@ exclude = [ "fixtures", "ci_webapp", "create_mountaineer_app", "media", "docs_we
9
9
 
10
10
  [tool.poetry]
11
11
  name = "mountaineer"
12
- version = "0.4.1.dev2"
12
+ version = "0.4.1.dev3"
13
13
  description = ""
14
14
  authors = [ "Pierce Freeman <pierce@freeman.vc>",]
15
15
  readme = "README.md"