UncountablePythonSDK 0.0.6__tar.gz → 0.0.7__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 (128) hide show
  1. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/PKG-INFO +1 -1
  2. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/UncountablePythonSDK.egg-info/PKG-INFO +1 -1
  3. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/UncountablePythonSDK.egg-info/SOURCES.txt +3 -0
  4. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/builder.py +0 -61
  5. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/config.py +3 -0
  6. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/emit_open_api.py +33 -22
  7. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/emit_open_api_util.py +6 -2
  8. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/emit_python.py +3 -2
  9. UncountablePythonSDK-0.0.7/type_spec/external/api/entity/create_entities.yaml +33 -0
  10. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/entity/create_entity.yaml +3 -13
  11. UncountablePythonSDK-0.0.7/type_spec/external/api/recipes/get_recipe_links.yaml +26 -0
  12. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/__init__.py +6 -0
  13. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/entity/create_entities.py +5 -25
  14. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/entity/create_entity.py +5 -11
  15. UncountablePythonSDK-0.0.7/uncountable/types/api/recipes/get_recipe_links.py +36 -0
  16. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/client_base.py +33 -30
  17. UncountablePythonSDK-0.0.7/uncountable/types/entity.py +271 -0
  18. UncountablePythonSDK-0.0.7/uncountable/types/field_values.py +28 -0
  19. UncountablePythonSDK-0.0.6/uncountable/types/api/recipes/get_recipe_links.py → UncountablePythonSDK-0.0.7/uncountable/types/recipe_links.py +0 -21
  20. UncountablePythonSDK-0.0.6/type_spec/external/api/entity/create_entities.yaml +0 -55
  21. UncountablePythonSDK-0.0.6/type_spec/external/api/recipes/get_recipe_links.yaml +0 -61
  22. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/.github/workflows/publish.yml +0 -0
  23. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/.gitignore +0 -0
  24. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/UncountablePythonSDK.egg-info/dependency_links.txt +0 -0
  25. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/UncountablePythonSDK.egg-info/requires.txt +0 -0
  26. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/UncountablePythonSDK.egg-info/top_level.txt +0 -0
  27. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/examples/create_entity.py +0 -0
  28. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/examples/recipe-import/importer.py +0 -0
  29. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/__init__.py +0 -0
  30. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/argument_parser/__init__.py +0 -0
  31. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/argument_parser/_is_enum.py +0 -0
  32. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/argument_parser/_is_namedtuple.py +0 -0
  33. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/argument_parser/argument_parser.py +0 -0
  34. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/argument_parser/case_convert.py +0 -0
  35. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/serialization/__init__.py +0 -0
  36. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/serialization/missing_sentry.py +0 -0
  37. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/serialization/opaque_key.py +0 -0
  38. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/serialization/serial_class.py +0 -0
  39. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/serialization_util/__init__.py +0 -0
  40. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/serialization_util/_get_type_for_serialization.py +0 -0
  41. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/serialization_util/serialization_helpers.py +0 -0
  42. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/strenum_compat/__init__.py +0 -0
  43. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/strenum_compat/strenum_compat.py +0 -0
  44. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/__init__.py +0 -0
  45. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/__main__.py +0 -0
  46. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/emit_io_ts.py +0 -0
  47. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/emit_typescript.py +0 -0
  48. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/emit_typescript_util.py +0 -0
  49. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/load_types.py +0 -0
  50. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/open_api_util.py +0 -0
  51. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/parts/base.py.prepart +0 -0
  52. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/parts/base.ts.prepart +0 -0
  53. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/test.py +0 -0
  54. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/type_info/__main__.py +0 -0
  55. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/type_info/emit_type_info.py +0 -0
  56. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/util.py +0 -0
  57. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/value_spec/__init__.py +0 -0
  58. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/value_spec/__main__.py +0 -0
  59. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/value_spec/convert_type.py +0 -0
  60. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/value_spec/emit_python.py +0 -0
  61. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pkgs/type_spec/value_spec/types.py +0 -0
  62. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/pyproject.toml +0 -0
  63. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/requirements.txt +0 -0
  64. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/setup.cfg +0 -0
  65. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/batch/execute_batch.yaml +0 -0
  66. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/entity/get_entities_data.yaml +0 -0
  67. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/entity/list_entities.yaml +0 -0
  68. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/entity/resolve_entity_ids.yaml +0 -0
  69. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/entity/set_values.yaml +0 -0
  70. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/input_groups/get_input_group_names.yaml +0 -0
  71. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/inputs/create_inputs.yaml +0 -0
  72. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/inputs/get_input_data.yaml +0 -0
  73. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/inputs/get_input_names.yaml +0 -0
  74. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/inputs/get_inputs_data.yaml +0 -0
  75. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/inputs/set_input_attribute_values.yaml +0 -0
  76. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/outputs/get_output_data.yaml +0 -0
  77. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/outputs/get_output_names.yaml +0 -0
  78. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/outputs/resolve_output_conditions.yaml +0 -0
  79. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/project/get_projects.yaml +0 -0
  80. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/project/get_projects_data.yaml +0 -0
  81. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/recipe_metadata/get_recipe_metadata_data.yaml +0 -0
  82. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/recipes/create_recipes.yaml +0 -0
  83. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/recipes/get_curve.yaml +0 -0
  84. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/recipes/get_recipe_calculations.yaml +0 -0
  85. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/recipes/get_recipe_names.yaml +0 -0
  86. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/recipes/get_recipe_output_metadata.yaml +0 -0
  87. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/recipes/get_recipes_data.yaml +0 -0
  88. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/recipes/set_recipe_inputs.yaml +0 -0
  89. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/type_spec/external/api/recipes/set_recipe_outputs.yaml +0 -0
  90. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/__init__.py +0 -0
  91. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/core/__init__.py +0 -0
  92. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/core/client.py +0 -0
  93. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/py.typed +0 -0
  94. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/__init__.py +0 -0
  95. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/batch/__init__.py +0 -0
  96. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/batch/execute_batch.py +0 -0
  97. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/entity/__init__.py +0 -0
  98. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/entity/get_entities_data.py +0 -0
  99. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/entity/list_entities.py +0 -0
  100. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/entity/resolve_entity_ids.py +0 -0
  101. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/entity/set_values.py +0 -0
  102. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/input_groups/__init__.py +0 -0
  103. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/input_groups/get_input_group_names.py +0 -0
  104. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/inputs/__init__.py +0 -0
  105. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/inputs/create_inputs.py +0 -0
  106. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/inputs/get_input_data.py +0 -0
  107. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/inputs/get_input_names.py +0 -0
  108. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/inputs/get_inputs_data.py +0 -0
  109. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/inputs/set_input_attribute_values.py +0 -0
  110. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/outputs/__init__.py +0 -0
  111. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/outputs/get_output_data.py +0 -0
  112. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/outputs/get_output_names.py +0 -0
  113. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/outputs/resolve_output_conditions.py +0 -0
  114. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/project/__init__.py +0 -0
  115. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/project/get_projects.py +0 -0
  116. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/project/get_projects_data.py +0 -0
  117. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/recipe_metadata/__init__.py +0 -0
  118. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/recipe_metadata/get_recipe_metadata_data.py +0 -0
  119. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/recipes/__init__.py +0 -0
  120. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/recipes/create_recipes.py +0 -0
  121. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/recipes/get_curve.py +0 -0
  122. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/recipes/get_recipe_calculations.py +0 -0
  123. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/recipes/get_recipe_names.py +0 -0
  124. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/recipes/get_recipe_output_metadata.py +0 -0
  125. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/recipes/get_recipes_data.py +0 -0
  126. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/recipes/set_recipe_inputs.py +0 -0
  127. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/api/recipes/set_recipe_outputs.py +0 -0
  128. {UncountablePythonSDK-0.0.6 → UncountablePythonSDK-0.0.7}/uncountable/types/base.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: UncountablePythonSDK
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Uncountable SDK
5
5
  Project-URL: Homepage, https://github.com/uncountableinc/uncountable-python-sdk
6
6
  Project-URL: Repository, https://github.com/uncountableinc/uncountable-python-sdk.git
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: UncountablePythonSDK
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Uncountable SDK
5
5
  Project-URL: Homepage, https://github.com/uncountableinc/uncountable-python-sdk
6
6
  Project-URL: Repository, https://github.com/uncountableinc/uncountable-python-sdk.git
@@ -82,6 +82,9 @@ uncountable/core/client.py
82
82
  uncountable/types/__init__.py
83
83
  uncountable/types/base.py
84
84
  uncountable/types/client_base.py
85
+ uncountable/types/entity.py
86
+ uncountable/types/field_values.py
87
+ uncountable/types/recipe_links.py
85
88
  uncountable/types/api/__init__.py
86
89
  uncountable/types/api/batch/__init__.py
87
90
  uncountable/types/api/batch/execute_batch.py
@@ -949,52 +949,6 @@ class SpecNamespace:
949
949
  )
950
950
  self.types[name] = spec_type
951
951
 
952
- def _validate_external_type_impl(
953
- self, stype: SpecType, rec_stack: list[SpecType]
954
- ) -> bool:
955
- if stype in rec_stack[:-1]:
956
- # recursive type definition ignore this instance
957
- return True
958
-
959
- if isinstance(stype, SpecTypeDefn):
960
- if stype.is_base or stype.is_predefined:
961
- # predefined and base types are always allowed
962
- return True
963
-
964
- if stype.namespace != self:
965
- # deny access to outside namespaces
966
- return False
967
-
968
- if isinstance(stype, SpecTypeDefnExternal):
969
- # external type definitions not support for external endpoints
970
- return False
971
-
972
- # check that referenced types themselves are allowed
973
- for child_type in stype.get_referenced_types():
974
- if not self._validate_external_type_wrap(child_type, rec_stack):
975
- return False
976
-
977
- return True
978
-
979
- def _print_external_type_stack(self, rec_stack: list[SpecType]) -> None:
980
- print(" -> ".join([str(x) for x in rec_stack]))
981
-
982
- def _validate_external_type_wrap(
983
- self, stype: SpecType, rec_stack: list[SpecType]
984
- ) -> bool:
985
- rec_stack.append(stype)
986
- if not self._validate_external_type_impl(stype, rec_stack):
987
- return False
988
- rec_stack.pop()
989
- return True
990
-
991
- def _validate_external_type(self, stype: SpecType) -> bool:
992
- rec_stack: list[SpecType] = []
993
- if not self._validate_external_type_wrap(stype, rec_stack):
994
- self._print_external_type_stack(rec_stack)
995
- return False
996
- return True
997
-
998
952
  def process(self, builder: SpecBuilder, data: RawDict) -> None:
999
953
  """
1000
954
  Complete the definition of each type.
@@ -1023,21 +977,6 @@ class SpecNamespace:
1023
977
 
1024
978
  builder.pop_where()
1025
979
 
1026
- # validate external endpoints
1027
- if self.endpoint is not None and self.endpoint.is_external:
1028
- # external endpoints are only allowed to reference types defined in the same namespace
1029
- for name, defn in self.types.items():
1030
- builder.push_where(name)
1031
-
1032
- if not self._validate_external_type(defn):
1033
- print(builder.where)
1034
- print(
1035
- f"Type '{name}' of external endpoint declaration references internal type definition!"
1036
- )
1037
- raise BuilderException()
1038
-
1039
- builder.pop_where()
1040
-
1041
980
  builder.pop_where()
1042
981
 
1043
982
 
@@ -74,6 +74,9 @@ class PythonConfig(BaseLanguageConfig):
74
74
  class OpenAPIConfig(BaseLanguageConfig):
75
75
  types_output: str # The folder to put generated openapi api yaml
76
76
  description: str # Description of api documentation
77
+ static_url_path: (
78
+ str # the base path where the generated yaml are hosted, e.g. /static/docs
79
+ )
77
80
  server_url: str | None = None
78
81
 
79
82
  def __post_init__(self: Self) -> None:
@@ -97,9 +97,6 @@ def emit_open_api(builder: builder.SpecBuilder, *, config: OpenAPIConfig) -> Non
97
97
  )
98
98
 
99
99
  for namespace in sorted(builder.namespaces.values(), key=lambda ns: ns.name):
100
- if namespace.endpoint is None:
101
- continue
102
-
103
100
  ctx = EmitOpenAPIContext(namespace=namespace)
104
101
 
105
102
  if ctx.namespace.name == "base":
@@ -111,7 +108,7 @@ def emit_open_api(builder: builder.SpecBuilder, *, config: OpenAPIConfig) -> Non
111
108
  gctx,
112
109
  ctx,
113
110
  namespace=namespace,
114
- types_output=config.types_output,
111
+ config=config,
115
112
  )
116
113
 
117
114
  _rewrite_with_notice(
@@ -149,10 +146,10 @@ def _emit_namespace(
149
146
  ctx: EmitOpenAPIContext,
150
147
  namespace: builder.SpecNamespace,
151
148
  *,
152
- types_output: str,
149
+ config: OpenAPIConfig,
153
150
  ) -> None:
154
151
  for stype in namespace.types.values():
155
- _emit_type(ctx, stype)
152
+ _emit_type(ctx, stype, config=config)
156
153
 
157
154
  if namespace.endpoint is not None:
158
155
  _emit_endpoint(gctx, ctx, namespace, namespace.endpoint)
@@ -218,12 +215,17 @@ def _emit_namespace(
218
215
  },
219
216
  )
220
217
 
221
- path = f"{types_output}/common/{'/'.join(namespace.path)}.yaml"
218
+ path = f"{config.types_output}/common/{'/'.join(namespace.path)}.yaml"
222
219
  oa_namespace = {"components": oa_components}
223
220
  _rewrite_with_notice(path, yaml.dump(oa_namespace, sort_keys=False))
224
221
 
225
222
 
226
- def _emit_type(ctx: EmitOpenAPIContext, stype: builder.SpecType) -> None:
223
+ def _emit_type(
224
+ ctx: EmitOpenAPIContext,
225
+ stype: builder.SpecType,
226
+ *,
227
+ config: OpenAPIConfig,
228
+ ) -> None:
227
229
  if not isinstance(stype, builder.SpecTypeDefn):
228
230
  return
229
231
  if stype.is_base or stype.is_predefined:
@@ -239,7 +241,7 @@ def _emit_type(ctx: EmitOpenAPIContext, stype: builder.SpecType) -> None:
239
241
 
240
242
  assert stype.is_exported, "expecting exported names"
241
243
  if isinstance(stype, builder.SpecTypeDefnAlias):
242
- ctx.types[stype.name] = open_api_type(ctx, stype.alias)
244
+ ctx.types[stype.name] = open_api_type(ctx, stype.alias, config=config)
243
245
  return
244
246
 
245
247
  if isinstance(stype, builder.SpecTypeDefnStringEnum):
@@ -259,14 +261,14 @@ def _emit_type(ctx: EmitOpenAPIContext, stype: builder.SpecType) -> None:
259
261
  return
260
262
  elif stype.properties is None:
261
263
  # TODO: check if these are actually equivalent
262
- ctx.types[stype.name] = open_api_type(ctx, stype.base)
264
+ ctx.types[stype.name] = open_api_type(ctx, stype.base, config=config)
263
265
  return
264
266
  else:
265
267
  properties: dict[str, OpenAPIType] = dict()
266
268
  property_desc: dict[str, str] = dict()
267
269
 
268
270
  for prop in stype.properties.values():
269
- ref_type = open_api_type(ctx, prop.spec_type)
271
+ ref_type = open_api_type(ctx, prop.spec_type, config=config)
270
272
  prop_name = ts_name(prop.name, prop.name_case or stype.name_case)
271
273
  if prop.desc:
272
274
  property_desc[prop_name] = prop.desc
@@ -294,7 +296,10 @@ def _emit_type(ctx: EmitOpenAPIContext, stype: builder.SpecType) -> None:
294
296
 
295
297
  if not stype.base.is_base:
296
298
  # support inheritance via allOf
297
- final_type = OpenAPIIntersectionType([open_api_type(ctx, stype.base), final_type])
299
+ final_type = OpenAPIIntersectionType([
300
+ open_api_type(ctx, stype.base, config=config),
301
+ final_type,
302
+ ])
298
303
 
299
304
  ctx.types[stype.name] = final_type
300
305
 
@@ -398,31 +403,37 @@ def _emit_value(stype: builder.SpecType, value: object) -> str:
398
403
  raise Exception("invalid constant type", value, stype)
399
404
 
400
405
 
401
- def open_api_type(ctx: EmitOpenAPIContext, stype: builder.SpecType) -> OpenAPIType:
406
+ def open_api_type(
407
+ ctx: EmitOpenAPIContext,
408
+ stype: builder.SpecType,
409
+ *,
410
+ config: OpenAPIConfig,
411
+ ) -> OpenAPIType:
402
412
  if isinstance(stype, builder.SpecTypeInstance):
403
413
  if stype.defn_type.name == builder.BaseTypeName.s_list:
404
- return OpenAPIArrayType(open_api_type(ctx, stype.parameters[0]))
414
+ return OpenAPIArrayType(
415
+ open_api_type(ctx, stype.parameters[0], config=config)
416
+ )
405
417
  if stype.defn_type.name == builder.BaseTypeName.s_union:
406
- return OpenAPIUnionType([open_api_type(ctx, p) for p in stype.parameters])
418
+ return OpenAPIUnionType([
419
+ open_api_type(ctx, p, config=config) for p in stype.parameters
420
+ ])
407
421
  if stype.defn_type.name == builder.BaseTypeName.s_literal:
408
422
  # IMPROVE relax the string constraint for literals (for now treat as string)
409
423
  parts = []
410
424
  for parameter in stype.parameters:
411
425
  assert isinstance(parameter, builder.SpecTypeLiteralWrapper)
412
- param_type = open_api_type(ctx, parameter)
413
-
414
- assert isinstance(param_type, OpenAPIEnumType)
415
- parts.extend(param_type.options)
426
+ parts.append(parameter.value)
416
427
 
417
428
  return OpenAPIEnumType([str(x) for x in parts])
418
429
  if stype.defn_type.name == builder.BaseTypeName.s_optional:
419
- ref_type = open_api_type(ctx, stype.parameters[0])
430
+ ref_type = open_api_type(ctx, stype.parameters[0], config=config)
420
431
  ref_type.nullable = True
421
432
  return ref_type
422
433
  if stype.defn_type.name == builder.BaseTypeName.s_tuple:
423
434
  # IMPROVE potentially handle tuples better: for now map tupples to arrays of those types
424
435
  return OpenAPIArrayType(
425
- [open_api_type(ctx, p) for p in stype.parameters],
436
+ [open_api_type(ctx, p, config=config) for p in stype.parameters],
426
437
  description="TupleType",
427
438
  )
428
439
 
@@ -449,5 +460,5 @@ def open_api_type(ctx: EmitOpenAPIContext, stype: builder.SpecType) -> OpenAPITy
449
460
  ctx.namespaces.add(stype.namespace)
450
461
  # external namespace resolution
451
462
  return OpenAPIRefType(
452
- source=f"{resolve_namespace_ref(ctx, stype.namespace)}/{stype.name}"
463
+ source=f"{resolve_namespace_ref(ctx, stype.namespace, config=config)}/{stype.name}"
453
464
  )
@@ -9,6 +9,7 @@ from dataclasses import dataclass, field
9
9
  from typing import TypeAlias
10
10
 
11
11
  from . import builder
12
+ from .config import OpenAPIConfig
12
13
  from .open_api_util import OpenAPIType
13
14
 
14
15
  MODIFY_NOTICE = "# DO NOT MODIFY -- This file is generated by type_spec"
@@ -74,9 +75,12 @@ class EmitOpenAPIContext:
74
75
 
75
76
 
76
77
  def resolve_namespace_ref(
77
- ctx: EmitOpenAPIContext, namespace: builder.SpecNamespace
78
+ ctx: EmitOpenAPIContext,
79
+ namespace: builder.SpecNamespace,
80
+ *,
81
+ config: OpenAPIConfig,
78
82
  ) -> str:
79
83
  # TODO: Handle namespaces not in root directory
80
84
  if len(ctx.namespace.path) == 1:
81
85
  return f"{namespace.name}.yaml#/components/schema"
82
- return f"/static/apidocs/common/{namespace.name}.yaml#/components/schema"
86
+ return f"{config.static_url_path}/common/{namespace.name}.yaml#/components/schema"
@@ -372,11 +372,12 @@ def _emit_endpoint_invocation_function(
372
372
  arguments_type.properties is not None
373
373
  and len(arguments_type.properties.values()) > 0
374
374
  )
375
-
375
+ assert endpoint.function is not None
376
+ function_name = endpoint.function.split(".")[-1]
376
377
  ctx.out.write("\n")
377
378
  ctx.out.write(
378
379
  f"""
379
- def {endpoint.path_basename}(
380
+ def {function_name}(
380
381
  self,\n"""
381
382
  )
382
383
  if has_arguments:
@@ -0,0 +1,33 @@
1
+ $endpoint:
2
+ is_sdk: true
3
+ method: post
4
+ path: ${external}/entity/external_create_entities
5
+ function: main.site.app.external.entity.create_entities.create_entities
6
+ desc: "Creates new Uncountable entities"
7
+
8
+
9
+ EntityToCreate:
10
+ type: Object
11
+ properties:
12
+ field_values?:
13
+ type: Optional<List<field_values.FieldRefNameValue>>
14
+
15
+ Arguments:
16
+ type: Object
17
+ properties:
18
+ definition_id:
19
+ type: Integer
20
+ desc: "Definition id for the entities to create"
21
+ entity_type:
22
+ type: Union<Literal<entity.EntityType.lab_request>, Literal<entity.EntityType.approval>, Literal<entity.EntityType.custom_entity>, Literal<entity.EntityType.task>, Literal<entity.EntityType.project>>
23
+ desc: "The type of the entities to create"
24
+ entities_to_create:
25
+ type: List<EntityToCreate>
26
+ desc: "A list of the entities to create"
27
+
28
+ Data:
29
+ type: Object
30
+ properties:
31
+ entities:
32
+ type: List<entity.Entity>
33
+ desc: The entities created
@@ -26,24 +26,14 @@ Arguments:
26
26
  type: Integer
27
27
  desc: "Definition id of the entity to create"
28
28
  entity_type:
29
- type: Union<Literal<'lab_request'>, Literal<'approval'>, Literal<'custom_entity'>, Literal<'task'>, Literal<'project'>>
29
+ type: Union<Literal<entity.EntityType.lab_request>, Literal<entity.EntityType.approval>, Literal<entity.EntityType.custom_entity>, Literal<entity.EntityType.task>, Literal<entity.EntityType.project>>
30
30
  desc: "The type of the entities requested"
31
31
  field_values?:
32
- type: Optional<List<EntityFieldInitialValue>>
33
-
34
- Entity:
35
- type: Object
36
- properties:
37
- id:
38
- type: Integer
39
- desc: "A unique identifier for the entity. Used in conjunction with entity type"
40
- type:
41
- type: String
42
- desc: "The type of entity"
32
+ type: Optional<List<field_values.FieldRefNameValue>>
43
33
 
44
34
  Data:
45
35
  type: Object
46
36
  properties:
47
37
  entity:
48
- type: Entity
38
+ type: entity.Entity
49
39
  desc: The entity created
@@ -0,0 +1,26 @@
1
+ $endpoint:
2
+ is_sdk: true
3
+ method: get
4
+ path: ${external}/recipes/external_get_recipe_links
5
+ function: main.site.app.external.recipes.get_recipe_links.get_recipe_links
6
+ desc: "Gets the links for the passed recipes"
7
+
8
+ Arguments:
9
+ type: Object
10
+ properties:
11
+ recipe_ids:
12
+ type: List<Integer>
13
+ desc: "Ids of the Recipes to retrieve links for"
14
+ depth:
15
+ type: Integer
16
+ desc: "How many layers deep to look for links"
17
+ default: 1
18
+ link_types:
19
+ type: Optional<List<recipe_links.RecipeLinkType>>
20
+ desc: "Optional filter to only desired link types"
21
+
22
+ Data:
23
+ type: Object
24
+ properties:
25
+ recipe_links:
26
+ type: List<recipe_links.RecipeLink>
@@ -8,7 +8,9 @@ from .api.entity import create_entities as create_entities_t
8
8
  from .api.entity import create_entity as create_entity_t
9
9
  from .api.inputs import create_inputs as create_inputs_t
10
10
  from .api.recipes import create_recipes as create_recipes_t
11
+ from . import entity as entity_t
11
12
  from .api.batch import execute_batch as execute_batch_t
13
+ from . import field_values as field_values_t
12
14
  from .api.recipes import get_curve as get_curve_t
13
15
  from .api.entity import get_entities_data as get_entities_data_t
14
16
  from .api.inputs import get_input_data as get_input_data_t
@@ -26,6 +28,7 @@ from .api.recipes import get_recipe_names as get_recipe_names_t
26
28
  from .api.recipes import get_recipe_output_metadata as get_recipe_output_metadata_t
27
29
  from .api.recipes import get_recipes_data as get_recipes_data_t
28
30
  from .api.entity import list_entities as list_entities_t
31
+ from . import recipe_links as recipe_links_t
29
32
  from .api.entity import resolve_entity_ids as resolve_entity_ids_t
30
33
  from .api.outputs import resolve_output_conditions as resolve_output_conditions_t
31
34
  from .api.inputs import set_input_attribute_values as set_input_attribute_values_t
@@ -40,7 +43,9 @@ __all__: list[str] = [
40
43
  "create_entity_t",
41
44
  "create_inputs_t",
42
45
  "create_recipes_t",
46
+ "entity_t",
43
47
  "execute_batch_t",
48
+ "field_values_t",
44
49
  "get_curve_t",
45
50
  "get_entities_data_t",
46
51
  "get_input_data_t",
@@ -58,6 +63,7 @@ __all__: list[str] = [
58
63
  "get_recipe_output_metadata_t",
59
64
  "get_recipes_data_t",
60
65
  "list_entities_t",
66
+ "recipe_links_t",
61
67
  "resolve_entity_ids_t",
62
68
  "resolve_output_conditions_t",
63
69
  "set_input_attribute_values_t",
@@ -8,16 +8,14 @@ import typing # noqa: F401
8
8
  import datetime # noqa: F401
9
9
  from decimal import Decimal # noqa: F401
10
10
  from dataclasses import dataclass
11
- from pkgs.serialization import serial_class
12
- from ... import base as base_t
11
+ from ... import entity as entity_t
12
+ from ... import field_values as field_values_t
13
13
 
14
14
  __all__: list[str] = [
15
15
  "Arguments",
16
16
  "Data",
17
17
  "ENDPOINT_METHOD",
18
18
  "ENDPOINT_PATH",
19
- "Entity",
20
- "EntityFieldInitialValue",
21
19
  "EntityToCreate",
22
20
  ]
23
21
 
@@ -25,40 +23,22 @@ ENDPOINT_METHOD = "POST"
25
23
  ENDPOINT_PATH = "api/external/entity/external_create_entities"
26
24
 
27
25
 
28
- # DO NOT MODIFY -- This file is generated by type_spec
29
- @serial_class(
30
- unconverted_values={"value"},
31
- )
32
- @dataclass(kw_only=True)
33
- class EntityFieldInitialValue:
34
- field_ref_name: str
35
- value: base_t.JsonValue
36
- row_index: typing.Optional[typing.Optional[int]] = None
37
-
38
-
39
26
  # DO NOT MODIFY -- This file is generated by type_spec
40
27
  @dataclass(kw_only=True)
41
28
  class EntityToCreate:
42
- field_values: typing.Optional[typing.Optional[list[EntityFieldInitialValue]]] = None
29
+ field_values: typing.Optional[typing.Optional[list[field_values_t.FieldRefNameValue]]] = None
43
30
 
44
31
 
45
32
  # DO NOT MODIFY -- This file is generated by type_spec
46
33
  @dataclass(kw_only=True)
47
34
  class Arguments:
48
35
  definition_id: int
49
- entity_type: typing.Union[typing.Literal["lab_request"], typing.Literal["approval"], typing.Literal["custom_entity"], typing.Literal["task"], typing.Literal["project"]]
36
+ entity_type: typing.Union[typing.Literal[entity_t.EntityType.LAB_REQUEST], typing.Literal[entity_t.EntityType.APPROVAL], typing.Literal[entity_t.EntityType.CUSTOM_ENTITY], typing.Literal[entity_t.EntityType.TASK], typing.Literal[entity_t.EntityType.PROJECT]]
50
37
  entities_to_create: list[EntityToCreate]
51
38
 
52
39
 
53
- # DO NOT MODIFY -- This file is generated by type_spec
54
- @dataclass(kw_only=True)
55
- class Entity:
56
- id: int
57
- type: str
58
-
59
-
60
40
  # DO NOT MODIFY -- This file is generated by type_spec
61
41
  @dataclass(kw_only=True)
62
42
  class Data:
63
- entities: list[Entity]
43
+ entities: list[entity_t.Entity]
64
44
  # DO NOT MODIFY -- This file is generated by type_spec
@@ -10,13 +10,14 @@ from decimal import Decimal # noqa: F401
10
10
  from dataclasses import dataclass
11
11
  from pkgs.serialization import serial_class
12
12
  from ... import base as base_t
13
+ from ... import entity as entity_t
14
+ from ... import field_values as field_values_t
13
15
 
14
16
  __all__: list[str] = [
15
17
  "Arguments",
16
18
  "Data",
17
19
  "ENDPOINT_METHOD",
18
20
  "ENDPOINT_PATH",
19
- "Entity",
20
21
  "EntityFieldInitialValue",
21
22
  ]
22
23
 
@@ -39,19 +40,12 @@ class EntityFieldInitialValue:
39
40
  @dataclass(kw_only=True)
40
41
  class Arguments:
41
42
  definition_id: int
42
- entity_type: typing.Union[typing.Literal["lab_request"], typing.Literal["approval"], typing.Literal["custom_entity"], typing.Literal["task"], typing.Literal["project"]]
43
- field_values: typing.Optional[typing.Optional[list[EntityFieldInitialValue]]] = None
44
-
45
-
46
- # DO NOT MODIFY -- This file is generated by type_spec
47
- @dataclass(kw_only=True)
48
- class Entity:
49
- id: int
50
- type: str
43
+ entity_type: typing.Union[typing.Literal[entity_t.EntityType.LAB_REQUEST], typing.Literal[entity_t.EntityType.APPROVAL], typing.Literal[entity_t.EntityType.CUSTOM_ENTITY], typing.Literal[entity_t.EntityType.TASK], typing.Literal[entity_t.EntityType.PROJECT]]
44
+ field_values: typing.Optional[typing.Optional[list[field_values_t.FieldRefNameValue]]] = None
51
45
 
52
46
 
53
47
  # DO NOT MODIFY -- This file is generated by type_spec
54
48
  @dataclass(kw_only=True)
55
49
  class Data:
56
- entity: Entity
50
+ entity: entity_t.Entity
57
51
  # DO NOT MODIFY -- This file is generated by type_spec
@@ -0,0 +1,36 @@
1
+ # DO NOT MODIFY -- This file is generated by type_spec
2
+ # flake8: noqa: F821
3
+ # ruff: noqa: E402
4
+ # fmt: off
5
+ # isort: skip_file
6
+ from __future__ import annotations
7
+ import typing # noqa: F401
8
+ import datetime # noqa: F401
9
+ from decimal import Decimal # noqa: F401
10
+ from dataclasses import dataclass
11
+ from ... import recipe_links as recipe_links_t
12
+
13
+ __all__: list[str] = [
14
+ "Arguments",
15
+ "Data",
16
+ "ENDPOINT_METHOD",
17
+ "ENDPOINT_PATH",
18
+ ]
19
+
20
+ ENDPOINT_METHOD = "GET"
21
+ ENDPOINT_PATH = "api/external/recipes/external_get_recipe_links"
22
+
23
+
24
+ # DO NOT MODIFY -- This file is generated by type_spec
25
+ @dataclass(kw_only=True)
26
+ class Arguments:
27
+ recipe_ids: list[int]
28
+ depth: int = 1
29
+ link_types: typing.Optional[list[recipe_links_t.RecipeLinkType]]
30
+
31
+
32
+ # DO NOT MODIFY -- This file is generated by type_spec
33
+ @dataclass(kw_only=True)
34
+ class Data:
35
+ recipe_links: list[recipe_links_t.RecipeLink]
36
+ # DO NOT MODIFY -- This file is generated by type_spec