Skip to content

Commit be98011

Browse files
authored
Merge pull request #21168 from mvdbeek/dev_openapi_typescript
Merge 25.1 into dev, fix openapi schema generation for TypedDict
2 parents 2e864f9 + 5a0318f commit be98011

File tree

12 files changed

+414
-276
lines changed

12 files changed

+414
-276
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ remove-api-schema:
203203
rm _shed_schema.yaml
204204

205205
update-client-api-schema: client-node-deps build-api-schema ## Update client API schema
206-
$(IN_VENV) cd client && npx openapi-typescript ../_schema.yaml > src/api/schema/schema.ts && npx prettier --write src/api/schema/schema.ts
207-
$(IN_VENV) cd client && npx openapi-typescript ../_shed_schema.yaml > ../lib/tool_shed/webapp/frontend/src/schema/schema.ts && npx prettier --write ../lib/tool_shed/webapp/frontend/src/schema/schema.ts
206+
$(IN_VENV) cd client && yarn openapi-typescript ../_schema.yaml -o src/api/schema/schema.ts && yarn prettier --write src/api/schema/schema.ts
207+
$(IN_VENV) cd client && yarn openapi-typescript ../_shed_schema.yaml -o ../lib/tool_shed/webapp/frontend/src/schema/schema.ts && yarn prettier --write ../lib/tool_shed/webapp/frontend/src/schema/schema.ts
208208
$(MAKE) remove-api-schema
209209

210210
lint-api-schema: build-api-schema

client/src/api/schema/schema.ts

Lines changed: 252 additions & 147 deletions
Large diffs are not rendered by default.

client/src/entry/analysis/modules/WorkflowEditor.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ export default {
4343
reloadEditor = false;
4444
this.skipNextReload = false;
4545
}
46-
if (reloadEditor) {
47-
this.editorReloadKey += 1;
48-
}
4946
5047
this.version = Query.get("version");
5148
this.storedWorkflowId = Query.get("id");
@@ -59,6 +56,10 @@ export default {
5956
const { id: storedWorkflowId } = await getWorkflowInfo(workflowId, this.version, true);
6057
this.storedWorkflowId = storedWorkflowId;
6158
}
59+
60+
if (reloadEditor) {
61+
this.editorReloadKey += 1;
62+
}
6263
},
6364
},
6465
};

client/yarn.lock

Lines changed: 106 additions & 119 deletions
Large diffs are not rendered by default.

lib/galaxy/dependencies/conditional-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
psycopg2-binary==2.9.10
33
mysqlclient
44
fluent-logger
5-
sentry-sdk[fastapi]
5+
sentry-sdk
66
pbs_python
77
drmaa
88
statsd

lib/galaxy/schema/schema.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ class LimitedUserModel(Model):
388388
SampleSheetColumnValueT = Union[int, float, bool, str, NoneType]
389389

390390

391-
class SampleSheetColumnDefinition(TypedDict):
391+
# type ignore because mypy can't handle closed TypedDicts yet
392+
class SampleSheetColumnDefinition(TypedDict, closed=True): # type: ignore[call-arg]
392393
name: str
393394
description: NotRequired[Optional[str]]
394395
type: SampleSheetColumnType

lib/galaxy/tool_util_models/tool_source.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ class DrillDownOptionsDict(TypedDict):
170170
FieldType = Union[CwlType, List[CwlType]]
171171

172172

173-
class FieldDict(TypedDict):
173+
# type ignore because mypy can't handle closed TypedDicts yet
174+
class FieldDict(TypedDict, closed=True): # type: ignore[call-arg]
174175
name: str
175176
type: FieldType
176177
format: NotRequired[Optional[str]]

lib/galaxy/tools/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ class safe_update(NamedTuple):
380380
"Show beginning1": safe_update(parse_version("1.0.0"), parse_version("1.0.2")),
381381
"Show tail1": safe_update(parse_version("1.0.0"), parse_version("1.0.1")),
382382
"sort1": safe_update(parse_version("1.1.0"), parse_version("1.2.0")),
383+
"Convert characters1": safe_update(parse_version("1.0.0"), parse_version("1.0.1")),
383384
"CONVERTER_interval_to_bgzip_0": safe_update(parse_version("1.0.1"), parse_version("1.0.2")),
384385
"CONVERTER_Bam_Bai_0": safe_update(parse_version("1.0.0"), parse_version("1.0.1")),
385386
"CONVERTER_cram_to_bam_0": safe_update(parse_version("1.0.1"), parse_version("1.0.2")),
@@ -3193,6 +3194,12 @@ class ExpressionTool(Tool):
31933194
tool_type_local = True
31943195
EXPRESSION_INPUTS_NAME = "_expression_inputs_.json"
31953196

3197+
def parse(self, tool_source: ToolSource, guid: Optional[str] = None, dynamic: bool = False) -> None:
3198+
super().parse(tool_source, guid, dynamic)
3199+
if self.profile < 19.05:
3200+
# Expression tools were introduced in 19.05 and we don't want crazy stuff like failing on stderr
3201+
self.profile = 19.05
3202+
31963203
def parse_command(self, tool_source):
31973204
self.command = f"cd ../; {expressions.EXPRESSION_SCRIPT_CALL}"
31983205
self.interpreter = None

lib/galaxy/webapps/galaxy/api/users.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ def delete_custom_builds(
596596
"/api/users",
597597
name="create_user",
598598
summary="Create a new Galaxy user. Only admins can create users for now.",
599+
require_admin=True,
599600
)
600601
def create(
601602
self,

lib/tool_shed/webapp/frontend/src/schema/schema.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,9 @@ export interface components {
14371437
* @default [
14381438
* "data"
14391439
* ]
1440+
* @example txt
1441+
* @example tabular
1442+
* @example tiff
14401443
*/
14411444
extensions: string[]
14421445
/**
@@ -1998,17 +2001,24 @@ export interface components {
19982001
/**
19992002
* Checksum
20002003
* @description A production (immutable) tool version is required to have a hashcode. Not required otherwise, but might be useful to detect changes. This exposes the hashcode for specific image versions to verify that the container version pulled is actually the version that was indexed by the registry.
2004+
* @example {
2005+
* "checksum": "77af4d6b9913e693e8d0b4b294fa62ade6054e6b2f1ffb617ac955dd63fb0182",
2006+
* "type": "sha256"
2007+
* }
20012008
*/
20022009
checksum?: components["schemas"]["Checksum"][] | null
20032010
/**
20042011
* Image Name
20052012
* @description Used in conjunction with a registry_url if provided to locate images.
2013+
* @example quay.io/seqware/seqware_full/1.1
2014+
* @example ubuntu:latest
20062015
*/
20072016
image_name?: string | null
20082017
image_type?: components["schemas"]["ImageType"] | null
20092018
/**
20102019
* Registry Host
20112020
* @description A docker registry or a URL to a Singularity registry. Used along with image_name to locate a specific image.
2021+
* @example registry.hub.docker.com
20122022
*/
20132023
registry_host?: string | null
20142024
/**
@@ -2194,12 +2204,14 @@ export interface components {
21942204
/**
21952205
* Name
21962206
* @description Name of the organization responsible for the service
2207+
* @example My organization
21972208
*/
21982209
name: string
21992210
/**
22002211
* Url
22012212
* Format: uri
22022213
* @description URL of the website of the organization (RFC 3986 format)
2214+
* @example https://example.com
22032215
*/
22042216
url: string
22052217
}
@@ -2793,36 +2805,43 @@ export interface components {
27932805
/**
27942806
* Contacturl
27952807
* @description URL of the contact for the provider of this service, e.g. a link to a contact form (RFC 3986 format), or an email (RFC 2368 format).
2808+
* @example mailto:[email protected]
27962809
*/
27972810
contactUrl?: string | null
27982811
/**
27992812
* Createdat
28002813
* @description Timestamp describing when the service was first deployed and available (RFC 3339 format)
2814+
* @example 2019-06-04T12:58:19Z
28012815
*/
28022816
createdAt?: string | null
28032817
/**
28042818
* Description
28052819
* @description Description of the service. Should be human readable and provide information about the service.
2820+
* @example This service provides...
28062821
*/
28072822
description?: string | null
28082823
/**
28092824
* Documentationurl
28102825
* @description URL of the documentation of this service (RFC 3986 format). This should help someone learn how to use your service, including any specifics required to access data, e.g. authentication.
2826+
* @example https://docs.myservice.example.com
28112827
*/
28122828
documentationUrl?: string | null
28132829
/**
28142830
* Environment
28152831
* @description Environment the service is running in. Use this to distinguish between production, development and testing/staging deployments. Suggested values are prod, test, dev, staging. However this is advised and not enforced.
2832+
* @example test
28162833
*/
28172834
environment?: string | null
28182835
/**
28192836
* Id
28202837
* @description Unique ID of this service. Reverse domain name notation is recommended, though not required. The identifier should attempt to be globally unique so it can be used in downstream aggregator services e.g. Service Registry.
2838+
* @example org.ga4gh.myservice
28212839
*/
28222840
id: string
28232841
/**
28242842
* Name
28252843
* @description Name of this service. Should be human readable.
2844+
* @example My project
28262845
*/
28272846
name: string
28282847
/** @description Organization providing the service */
@@ -2831,11 +2850,13 @@ export interface components {
28312850
/**
28322851
* Updatedat
28332852
* @description Timestamp describing when the service was last updated (RFC 3339 format)
2853+
* @example 2019-06-04T12:58:19Z
28342854
*/
28352855
updatedAt?: string | null
28362856
/**
28372857
* Version
28382858
* @description Version of the service being described. Semantic versioning is recommended, but other identifiers, such as dates or commit hashes, are also allowed. The version should be changed whenever the service is updated.
2859+
* @example 1.0.0
28392860
*/
28402861
version: string
28412862
}
@@ -2844,16 +2865,19 @@ export interface components {
28442865
/**
28452866
* Artifact
28462867
* @description Name of the API or GA4GH specification implemented. Official GA4GH types should be assigned as part of standards approval process. Custom artifacts are supported.
2868+
* @example beacon
28472869
*/
28482870
artifact: string
28492871
/**
28502872
* Group
28512873
* @description Namespace in reverse domain name format. Use `org.ga4gh` for implementations compliant with official GA4GH specifications. For services with custom APIs not standardized by GA4GH, or implementations diverging from official GA4GH specifications, use a different namespace (e.g. your organization's reverse domain name).
2874+
* @example org.ga4gh
28522875
*/
28532876
group: string
28542877
/**
28552878
* Version
28562879
* @description Version of the API or specification. GA4GH specifications use semantic versioning.
2880+
* @example 1.0.0
28572881
*/
28582882
version: string
28592883
}
@@ -3023,6 +3047,7 @@ export interface components {
30233047
/**
30243048
* Id
30253049
* @description A unique identifier of the tool, scoped to this registry.
3050+
* @example 123456
30263051
*/
30273052
id: string
30283053
/**
@@ -3044,6 +3069,7 @@ export interface components {
30443069
/**
30453070
* Url
30463071
* @description The URL for this tool in this registry.
3072+
* @example http://agora.broadinstitute.org/tools/123456
30473073
*/
30483074
url: string
30493075
/**
@@ -3300,13 +3326,19 @@ export interface components {
33003326
/**
33013327
* Descriptor Type Version
33023328
* @description A map providing information about the language versions used in this tool. The keys should be the same values used in the `descriptor_type` field, and the value should be an array of all the language versions used for the given `descriptor_type`. Depending on the `descriptor_type` (e.g. CWL) multiple version values may be used in a single tool.
3329+
* @example {
3330+
* "WDL": ["1.0", "1.0"],
3331+
* "CWL": ["v1.0.2"],
3332+
* "NFL": ["DSL2"]
3333+
* }
33033334
*/
33043335
descriptor_type_version?: {
33053336
[key: string]: components["schemas"]["DescriptorTypeVersion"][]
33063337
} | null
33073338
/**
33083339
* Id
33093340
* @description An identifier of the version of this tool for this particular tool registry.
3341+
* @example v1
33103342
*/
33113343
id: string
33123344
/**
@@ -3317,6 +3349,8 @@ export interface components {
33173349
/**
33183350
* Included Apps
33193351
* @description An array of IDs for the applications that are stored inside this tool.
3352+
* @example https://bio.tools/tool/mytum.de/SNAP2/1
3353+
* @example https://bio.tools/bioexcel_seqqc
33203354
*/
33213355
included_apps?: string[] | null
33223356
/**
@@ -3342,6 +3376,7 @@ export interface components {
33423376
/**
33433377
* Url
33443378
* @description The URL for this tool version in this registry.
3379+
* @example http://agora.broadinstitute.org/tools/123456/versions/1
33453380
*/
33463381
url: string
33473382
/**

0 commit comments

Comments
 (0)