Skip to content

Commit

Permalink
minor decription tidy up (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
philkra authored Feb 7, 2023
1 parent b46856d commit 65daa9d
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 58 deletions.
15 changes: 8 additions & 7 deletions codegen/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def generate_namespace(
"""
vars = {
"class_name": namespace["x-displayName"].replace(" ", "_").lower().capitalize(),
"class_description": namespace["description"]
"class_description": namespace["description"].strip()
if "description" in namespace
else namespace["x-displayName"],
else namespace["x-displayName"].strip(),
"spec_scope": scope,
"spec_version": spec_version,
"spec_base_url": spec_base_url,
Expand Down Expand Up @@ -112,10 +112,10 @@ def generate_endpoint(
Generate a single endpoint
"""
vars = {
"operation_id": endpoint["operationId"],
"description": endpoint["description"]
"operation_id": endpoint["operationId"].strip(),
"description": endpoint["description"].strip()
if "description" in endpoint
else endpoint["summary"],
else endpoint["summary"].strip(),
"http_method": method.upper(),
"path": path.lower(),
"params": get_endpoint_params(path, endpoint, parameters, references),
Expand Down Expand Up @@ -144,9 +144,9 @@ def get_endpoint_params(
exit(11)
skel["list"].append(
{
"name": references[r["$ref"]]["name"],
"name": references[r["$ref"]]["name"].strip(),
"type": references[references[r["$ref"]]["schema"]["$ref"]]["type"],
"description": references[r["$ref"]]["description"],
"description": references[r["$ref"]]["description"].strip(),
}
)

Expand Down Expand Up @@ -223,3 +223,4 @@ def resolve_references(spec: dict) -> dict:
)
generate_endpoints(path, endpoints, references)
it += 1
logging.info("done.")
4 changes: 2 additions & 2 deletions xata/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_scope(self) -> str:
return self.scope

def get_base_url(self) -> str:
if self.is_control_plane == True:
if self.is_control_plane:
return self.base_url
return self.base_url.replace(
"{workspaceId}", self.client.get_config()["workspaceId"]
Expand All @@ -33,7 +33,7 @@ def request(
} # TODO use "|" when client py min version >= 3.9
url = "%s/%s" % (self.get_base_url(), url_path.lstrip("/"))

if payload == None:
if payload is None:
resp = request(http_method, url, headers=headers)
else:
resp = request(http_method, url, headers=headers, json=payload)
Expand Down
10 changes: 0 additions & 10 deletions xata/namespaces/workspace/branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def getBranchDetails(self, db_branch_name: str) -> Response:
method: GET
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:return Response
"""
url_path = f"/db/{db_branch_name}"
Expand All @@ -47,7 +46,6 @@ def createBranch(self, db_branch_name: str, payload: dict) -> Response:
method: PUT
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand All @@ -62,7 +60,6 @@ def deleteBranch(self, db_branch_name: str) -> Response:
method: DELETE
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:return Response
"""
url_path = f"/db/{db_branch_name}"
Expand All @@ -75,7 +72,6 @@ def getBranchMetadata(self, db_branch_name: str) -> Response:
method: GET
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:return Response
"""
url_path = f"/db/{db_branch_name}/metadata"
Expand All @@ -88,7 +84,6 @@ def updateBranchMetadata(self, db_branch_name: str, payload: dict) -> Response:
method: PUT
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand All @@ -103,7 +98,6 @@ def getBranchStats(self, db_branch_name: str) -> Response:
method: GET
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:return Response
"""
url_path = f"/db/{db_branch_name}/stats"
Expand Down Expand Up @@ -133,7 +127,6 @@ def getGitBranchesMapping(self, db_name: str) -> Response:
]
}
```
path: /dbs/{db_name}/gitbranches
method: GET
Expand All @@ -158,7 +151,6 @@ def addGitBranchesEntry(self, db_name: str, payload: dict) -> Response:
"xataBranch": "fix_bug"
}
```
path: /dbs/{db_name}/gitbranches
method: POST
Expand All @@ -179,7 +171,6 @@ def removeGitBranchesEntry(self, db_name: str) -> Response:
```json
// DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123
```
path: /dbs/{db_name}/gitbranches
method: DELETE
Expand Down Expand Up @@ -214,7 +205,6 @@ def resolveBranch(self, db_name: str) -> Response:
}
}
```
path: /dbs/{db_name}/resolvebranch
method: GET
Expand Down
9 changes: 0 additions & 9 deletions xata/namespaces/workspace/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def getBranchMigrationHistory(self, db_branch_name: str, payload: dict) -> Respo
method: GET
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand All @@ -37,7 +36,6 @@ def getBranchMigrationPlan(self, db_branch_name: str, payload: dict) -> Response
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand All @@ -54,7 +52,6 @@ def executeBranchMigrationPlan(
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand All @@ -69,7 +66,6 @@ def getBranchSchemaHistory(self, db_branch_name: str, payload: dict) -> Response
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand All @@ -86,7 +82,6 @@ def compareBranchWithUserSchema(
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand All @@ -103,7 +98,6 @@ def compareBranchSchemas(
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param branch_name: str The Database Name
:param payload: dict Request Body
:return Response
Expand All @@ -119,7 +113,6 @@ def updateBranchSchema(self, db_branch_name: str, payload: dict) -> Response:
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand All @@ -134,7 +127,6 @@ def previewBranchSchemaEdit(self, db_branch_name: str, payload: dict) -> Respons
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand All @@ -149,7 +141,6 @@ def applyBranchSchemaEdit(self, db_branch_name: str, payload: dict) -> Response:
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand Down
8 changes: 0 additions & 8 deletions xata/namespaces/workspace/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def branchTransaction(self, db_branch_name: str, payload: dict) -> Response:
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand All @@ -39,7 +38,6 @@ def insertRecord(
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param table_name: str The Table name
:param columns: list Column filters
:param payload: dict Request Body
Expand All @@ -58,7 +56,6 @@ def getRecord(
method: GET
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param table_name: str The Table name
:param record_id: str The Record name
:param columns: list Column filters
Expand All @@ -81,7 +78,6 @@ def insertRecordWithID(
method: PUT
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param table_name: str The Table name
:param record_id: str The Record name
:param columns: list Column filters
Expand All @@ -106,7 +102,6 @@ def upsertRecordWithID(
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param table_name: str The Table name
:param record_id: str The Record name
:param columns: list Column filters
Expand All @@ -126,7 +121,6 @@ def deleteRecord(
method: DELETE
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param table_name: str The Table name
:param record_id: str The Record name
:param columns: list Column filters
Expand All @@ -149,7 +143,6 @@ def updateRecordWithID(
method: PATCH
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param table_name: str The Table name
:param record_id: str The Record name
:param columns: list Column filters
Expand All @@ -169,7 +162,6 @@ def bulkInsertTableRecords(
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param table_name: str The Table name
:param columns: list Column filters
:param payload: dict Request Body
Expand Down
9 changes: 0 additions & 9 deletions xata/namespaces/workspace/search_and_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,12 +773,10 @@ def queryTable(
}
}
```
path: /db/{db_branch_name}/tables/{table_name}/query
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param table_name: str The Table name
:param payload: dict Request Body
:return Response
Expand All @@ -794,7 +792,6 @@ def searchBranch(self, db_branch_name: str, payload: dict) -> Response:
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param payload: dict Request Body
:return Response
"""
Expand All @@ -811,12 +808,10 @@ def searchTable(
The endpoint accepts a `query` parameter that is used for the free text search and a set of structured filters (via the `filter` parameter) that are applied before the search. The `filter` parameter uses the same syntax as the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:
* filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
* filtering on columns of type `multiple` is currently unsupported
path: /db/{db_branch_name}/tables/{table_name}/search
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param table_name: str The Table name
:param payload: dict Request Body
:return Response
Expand Down Expand Up @@ -891,12 +886,10 @@ def summarizeTable(
`page.size`: tells Xata how many records to return. If unspecified, Xata
will return the default size.
path: /db/{db_branch_name}/tables/{table_name}/summarize
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param table_name: str The Table name
:param payload: dict Request Body
:return Response
Expand All @@ -917,12 +910,10 @@ def aggregateTable(
(e.g for cardinality), and is generally faster and can do more complex aggregations.
For usage, see the [API Guide](https://xata.io/docs/api-guide/aggregate).
path: /db/{db_branch_name}/tables/{table_name}/aggregate
method: POST
:param db_branch_name: str The DBBranchName matches the pattern `{db_name}:{branch_name}`.
:param table_name: str The Table name
:param payload: dict Request Body
:return Response
Expand Down
Loading

0 comments on commit 65daa9d

Please sign in to comment.