geniespec 0.1.2.dev12__tar.gz → 0.1.2.dev13__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.
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/PKG-INFO +3 -3
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/README.md +2 -2
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/pyproject.toml +1 -1
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/pyproject.toml.orig +1 -1
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/genie.py +5 -1
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/__init__.py +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/api_schema.yaml +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/cli.py +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/languages.py +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/renderable_types.py +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/templates/python-server/{service}/__init__.py.j2 +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/templates/python-server/{service}/v{version}/__init__.py.j2 +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/templates/python-server/{service}/v{version}/api.py.j2 +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/templates/python-server/{service}/v{version}/endpoints.py.j2 +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/templates/python-server/{service}/v{version}/exceptions.py.j2 +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/templates/python-server/{service}/v{version}/internal.py.j2 +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/templates/python-server/{service}/v{version}/resources.py.j2 +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/templates/typescript-client/{service}/v{version}/client.ts.j2 +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/templates/typescript-client/{service}/v{version}/endpoints.ts.j2 +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/templates/typescript-client/{service}/v{version}/index.ts.j2 +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/templates/typescript-client/{service}/v{version}/resources.ts.j2 +0 -0
- {geniespec-0.1.2.dev12 → geniespec-0.1.2.dev13}/src/geniespec/types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: geniespec
|
|
3
|
-
Version: 0.1.2.
|
|
3
|
+
Version: 0.1.2.dev13
|
|
4
4
|
Summary: Generate API code from an api.yaml spec
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Requires-Dist: jinja2>=3.1.6
|
|
@@ -117,11 +117,11 @@ resources:
|
|
|
117
117
|
extensions: {deprecated: true}
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
`python-server` passes the transition fields to kiba-core's `route`, whose `OpenApiSchemaGenerator` documents every route with an `operationId` (and skips the rest); `extensions` reach `OpenApiExtension`s as `metadata['extensions']`. Field descriptions become pydantic `Field(description=...)`, so they show up in the request and response schemas. Each `operationId` must be unique, so a transition that generates more than one route (for example `GET` on a resource
|
|
120
|
+
`python-server` passes the transition fields to kiba-core's `route`, whose `OpenApiSchemaGenerator` documents every route with an `operationId` (and skips the rest); `extensions` reach `OpenApiExtension`s as `metadata['extensions']`. Field descriptions become pydantic `Field(description=...)`, so they show up in the request and response schemas. Each `operationId` must be unique, so a transition that generates more than one route (for example a `GET` on a resource that is also `accessibleFrom` root) can't set one. `typescript-client` ignores these fields.
|
|
121
121
|
|
|
122
122
|
## Unique attributes
|
|
123
123
|
|
|
124
|
-
Resources are addressed by their primary attribute. A `GET` transition also adds a lookup for each `isUnique` attribute (`/assets/address/{address}`), and, on a child resource, for each `isUniqueInParent` attribute: one that is only unique within its parent, like an asset's address on a chain. Those lookups only exist through the parent (`/chains/{chainId}/assets/address/{address}`), never from root or another ancestor.
|
|
124
|
+
Resources are addressed by their primary attribute. A `GET` transition also adds a lookup for each `isUnique` attribute (`/assets/address/{address}`), and, on a child resource, for each `isUniqueInParent` attribute: one that is only unique within its parent, like an asset's address on a chain. Those lookups only exist through the parent (`/chains/{chainId}/assets/address/{address}`), never from root or another ancestor. Lookups share the `GET` transition's documentation fields, with `By<Attribute>` added to its `operationId` (`getAsset` → `getAssetByAddress`).
|
|
125
125
|
|
|
126
126
|
## Overrides
|
|
127
127
|
|
|
@@ -103,11 +103,11 @@ resources:
|
|
|
103
103
|
extensions: {deprecated: true}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
`python-server` passes the transition fields to kiba-core's `route`, whose `OpenApiSchemaGenerator` documents every route with an `operationId` (and skips the rest); `extensions` reach `OpenApiExtension`s as `metadata['extensions']`. Field descriptions become pydantic `Field(description=...)`, so they show up in the request and response schemas. Each `operationId` must be unique, so a transition that generates more than one route (for example `GET` on a resource
|
|
106
|
+
`python-server` passes the transition fields to kiba-core's `route`, whose `OpenApiSchemaGenerator` documents every route with an `operationId` (and skips the rest); `extensions` reach `OpenApiExtension`s as `metadata['extensions']`. Field descriptions become pydantic `Field(description=...)`, so they show up in the request and response schemas. Each `operationId` must be unique, so a transition that generates more than one route (for example a `GET` on a resource that is also `accessibleFrom` root) can't set one. `typescript-client` ignores these fields.
|
|
107
107
|
|
|
108
108
|
## Unique attributes
|
|
109
109
|
|
|
110
|
-
Resources are addressed by their primary attribute. A `GET` transition also adds a lookup for each `isUnique` attribute (`/assets/address/{address}`), and, on a child resource, for each `isUniqueInParent` attribute: one that is only unique within its parent, like an asset's address on a chain. Those lookups only exist through the parent (`/chains/{chainId}/assets/address/{address}`), never from root or another ancestor.
|
|
110
|
+
Resources are addressed by their primary attribute. A `GET` transition also adds a lookup for each `isUnique` attribute (`/assets/address/{address}`), and, on a child resource, for each `isUniqueInParent` attribute: one that is only unique within its parent, like an asset's address on a chain. Those lookups only exist through the parent (`/chains/{chainId}/assets/address/{address}`), never from root or another ancestor. Lookups share the `GET` transition's documentation fields, with `By<Attribute>` added to its `operationId` (`getAsset` → `getAssetByAddress`).
|
|
111
111
|
|
|
112
112
|
## Overrides
|
|
113
113
|
|
|
@@ -529,6 +529,7 @@ class Renderer:
|
|
|
529
529
|
authentication = transition.authentication or api.defaultAuthentication
|
|
530
530
|
rateLimit = transition.rateLimit or api.defaultRateLimit
|
|
531
531
|
operationCount = len(renderableApi.operations)
|
|
532
|
+
lookupOperations: list[tuple[RenderableOperation, Attribute]] = []
|
|
532
533
|
method: RenderableMethod = self._transition_to_renderable_method(transition=transition)
|
|
533
534
|
if transition.isIndirectAction and transition.action.upper() in {'DELETE', 'CREATE', 'UPDATE', 'GET', 'LIST'}:
|
|
534
535
|
raise SemanticValidationException(message=f'Only custom transitions can be indirect actions: {transition.action}')
|
|
@@ -577,7 +578,7 @@ class Renderer:
|
|
|
577
578
|
),
|
|
578
579
|
]
|
|
579
580
|
)
|
|
580
|
-
|
|
581
|
+
lookupOperations.append((RenderableOperation(method=method, endpoint=getByUniqueEndpoint, query=None, body=None, responseFields=[returnValue], authentication=authentication, rateLimit=rateLimit), attribute))
|
|
581
582
|
elif transition.action.upper() == 'LIST':
|
|
582
583
|
returnValue = RenderableField(name=processableResource.renderableResource.collectionName, fieldType=RenderableType(rawType='class', className=processableResource.renderableResource.singleName, isNullable=False, isList=True))
|
|
583
584
|
query = [self._request_field_to_renderable_parameter(requestField=requestField, knownTypeNames=knownTypeNames) for requestField in transition.requestFields]
|
|
@@ -595,6 +596,9 @@ class Renderer:
|
|
|
595
596
|
renderableApi.operations.append(self._action_operation(transition=transition, endpoint=customEndpoint, knownTypeNames=knownTypeNames, defaultAuthentication=api.defaultAuthentication, defaultRateLimit=api.defaultRateLimit, isIndirectAction=transition.isIndirectAction))
|
|
596
597
|
isStandard = transition.action.upper() in {'CREATE', 'UPDATE', 'GET', 'LIST'}
|
|
597
598
|
renderableApi.operations[operationCount:] = [self._with_transition_fields(operation=operation, transition=transition, isStandard=isStandard) for operation in renderableApi.operations[operationCount:]]
|
|
599
|
+
for operation, attribute in lookupOperations:
|
|
600
|
+
lookupOperationId = f'{transition.operationId}By{RenderableString.from_kebab_case_string(string=attribute.name).pascalCaseString}' if transition.operationId is not None else None
|
|
601
|
+
renderableApi.operations.append(self._with_transition_fields(operation=operation, transition=transition, isStandard=isStandard).model_copy(update={'operationId': lookupOperationId}))
|
|
598
602
|
if len(renderableApi.operations) == operationCount:
|
|
599
603
|
uncoveredTransitions.append(f'{renderableResource.singleName.pascalCaseString} {transition.action}')
|
|
600
604
|
if uncoveredTransitions:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|