mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #15173 from mvdbeek/fix_consts
Properly annotate `model_class` fields as const and required in openAPI schema
This commit is contained in:
@@ -171,7 +171,7 @@ endif
|
||||
|
||||
|
||||
update-client-api-schema: node-deps
|
||||
$(IN_VENV) cd client && python ../scripts/dump_openapi_schema.py | yarn run openapi-typescript --output src/schema/schema.ts && npx prettier --write src/schema/schema.ts
|
||||
$(IN_VENV) cd client && python ../scripts/dump_openapi_schema.py _schema.json && node openapi_to_schema.mjs _schema.json > src/schema/schema.ts && npx prettier --write src/schema/schema.ts && rm _schema.json
|
||||
|
||||
client: node-deps ## Rebuild client-side artifacts for local development.
|
||||
cd client && yarn run build
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// this is a helper script that fixes const values
|
||||
// upstream fix in https://github.com/drwpow/openapi-typescript/pull/1014
|
||||
import openapiTS from "openapi-typescript";
|
||||
|
||||
const inputFilePath = process.argv[2];
|
||||
|
||||
const localPath = new URL(inputFilePath, import.meta.url);
|
||||
openapiTS(localPath, {
|
||||
transform(schemaObject, metadata) {
|
||||
if ("const" in schemaObject && schemaObject.type === "string") {
|
||||
return `"${schemaObject.const}"`;
|
||||
}
|
||||
},
|
||||
}).then((output) => console.log(output));
|
||||
+496
-5
@@ -228,6 +228,10 @@ export interface paths {
|
||||
*/
|
||||
get: operations["types_and_mapping_api_datatypes_types_and_mapping_get"];
|
||||
};
|
||||
"/api/drs_download/{object_id}": {
|
||||
/** Download */
|
||||
get: operations["download_api_drs_download__object_id__get"];
|
||||
};
|
||||
"/api/folders/{folder_id}/contents": {
|
||||
/**
|
||||
* Returns a list of a folder's contents (files and sub-folders) with additional metadata about the folder.
|
||||
@@ -1311,6 +1315,22 @@ export interface paths {
|
||||
/** List all versions of a workflow. */
|
||||
get: operations["show_versions_api_workflows__workflow_id__versions_get"];
|
||||
};
|
||||
"/ga4gh/drs/v1/objects/{object_id}": {
|
||||
/** Get Object */
|
||||
get: operations["get_object_ga4gh_drs_v1_objects__object_id__get"];
|
||||
/** Get Object */
|
||||
post: operations["get_object_ga4gh_drs_v1_objects__object_id__post"];
|
||||
};
|
||||
"/ga4gh/drs/v1/objects/{object_id}/access/{access_id}": {
|
||||
/** Get Access Url */
|
||||
get: operations["get_access_url_ga4gh_drs_v1_objects__object_id__access__access_id__get"];
|
||||
/** Get Access Url */
|
||||
post: operations["get_access_url_ga4gh_drs_v1_objects__object_id__access__access_id__post"];
|
||||
};
|
||||
"/ga4gh/drs/v1/service-info": {
|
||||
/** Service Info */
|
||||
get: operations["service_info_ga4gh_drs_v1_service_info_get"];
|
||||
};
|
||||
}
|
||||
|
||||
export type webhooks = Record<string, never>;
|
||||
@@ -1331,6 +1351,41 @@ export interface components {
|
||||
*/
|
||||
key: string;
|
||||
};
|
||||
/** AccessMethod */
|
||||
AccessMethod: {
|
||||
/**
|
||||
* Access Id
|
||||
* @description An arbitrary string to be passed to the `/access` method to get an `AccessURL`. This string must be unique within the scope of a single object. Note that at least one of `access_url` and `access_id` must be provided.
|
||||
*/
|
||||
access_id?: string;
|
||||
/**
|
||||
* Access Url
|
||||
* @description An `AccessURL` that can be used to fetch the actual object bytes. Note that at least one of `access_url` and `access_id` must be provided.
|
||||
*/
|
||||
access_url?: components["schemas"]["AccessURL"];
|
||||
/**
|
||||
* Region
|
||||
* @description Name of the region in the cloud service provider that the object belongs to.
|
||||
* @example us-east-1
|
||||
*/
|
||||
region?: string;
|
||||
/** @description Type of the access method. */
|
||||
type: components["schemas"]["Type"];
|
||||
};
|
||||
/** AccessURL */
|
||||
AccessURL: {
|
||||
/**
|
||||
* Headers
|
||||
* @description An optional list of headers to include in the HTTP request to `url`. These headers can be used to provide auth tokens required to fetch the object bytes.
|
||||
* @example Authorization: Basic Z2E0Z2g6ZHJz
|
||||
*/
|
||||
headers?: string[];
|
||||
/**
|
||||
* Url
|
||||
* @description A fully resolvable URL that can be used to fetch the actual object bytes.
|
||||
*/
|
||||
url: string;
|
||||
};
|
||||
/**
|
||||
* AsyncFile
|
||||
* @description Base model definition with common configuration used by all derived models.
|
||||
@@ -1466,6 +1521,22 @@ export interface components {
|
||||
*/
|
||||
status: "ok" | "error";
|
||||
};
|
||||
/** Checksum */
|
||||
Checksum: {
|
||||
/**
|
||||
* Checksum
|
||||
* @description The hex-string encoded checksum for the data
|
||||
*/
|
||||
checksum: string;
|
||||
/**
|
||||
* Type
|
||||
* @description The digest method used to create the checksum.
|
||||
* The value (e.g. `sha-256`) SHOULD be listed as `Hash Name String` in the https://www.iana.org/assignments/named-information/named-information.xhtml#hash-alg[IANA Named Information Hash Algorithm Registry]. Other values MAY be used, as long as implementors are aware of the issues discussed in https://tools.ietf.org/html/rfc6920#section-9.4[RFC6920].
|
||||
* GA4GH may provide more explicit guidance for use of non-IANA-registered algorithms in the future. Until then, if implementors do choose such an algorithm (e.g. because it's implemented by their storage provider), they SHOULD use an existing standard `type` value such as `md5`, `etag`, `crc32c`, `trunc512`, or `sha1`.
|
||||
* @example sha-256
|
||||
*/
|
||||
type: string;
|
||||
};
|
||||
/**
|
||||
* CollectionElementIdentifier
|
||||
* @description Base model definition with common configuration used by all derived models.
|
||||
@@ -1627,6 +1698,30 @@ export interface components {
|
||||
*/
|
||||
hash_function?: components["schemas"]["HashFunctionNameEnum"];
|
||||
};
|
||||
/** ContentsObject */
|
||||
ContentsObject: {
|
||||
/**
|
||||
* Contents
|
||||
* @description If this ContentsObject describes a nested bundle and the caller specified "?expand=true" on the request, then this contents array must be present and describe the objects within the nested bundle.
|
||||
*/
|
||||
contents?: components["schemas"]["ContentsObject"][];
|
||||
/**
|
||||
* Drs Uri
|
||||
* @description A list of full DRS identifier URI paths that may be used to obtain the object. These URIs may be external to this DRS instance.
|
||||
* @example drs://drs.example.org/314159
|
||||
*/
|
||||
drs_uri?: string[];
|
||||
/**
|
||||
* Id
|
||||
* @description A DRS identifier of a `DrsObject` (either a single blob or a nested bundle). If this ContentsObject is an object within a nested bundle, then the id is optional. Otherwise, the id is required.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* Name
|
||||
* @description A name declared by the bundle author that must be used when materialising this object, overriding any name directly associated with the object itself. The name must be unique with the containing bundle. This string is made up of uppercase and lowercase letters, decimal digits, hypen, period, and underscore [A-Za-z0-9.-_]. See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282[portable filenames].
|
||||
*/
|
||||
name: string;
|
||||
};
|
||||
/**
|
||||
* ConvertedDatasetsMap
|
||||
* @description Map of `file extension` -> `converted dataset encoded id`
|
||||
@@ -1974,6 +2069,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default Quota
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "Quota";
|
||||
@@ -2043,6 +2140,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default DatasetCollectionElement
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "DatasetCollectionElement";
|
||||
@@ -2095,6 +2194,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default DatasetCollection
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "DatasetCollection";
|
||||
@@ -2208,6 +2309,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default HistoryDatasetCollectionAssociation
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "HistoryDatasetCollectionAssociation";
|
||||
@@ -2486,6 +2589,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default DefaultQuotaAssociation
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "DefaultQuotaAssociation";
|
||||
@@ -3078,6 +3183,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default Group
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "Group";
|
||||
@@ -3100,6 +3207,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default GroupQuotaAssociation
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "GroupQuotaAssociation";
|
||||
@@ -3430,6 +3539,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default HistoryDatasetAssociation
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "HistoryDatasetAssociation";
|
||||
@@ -3616,6 +3727,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default HistoryDatasetCollectionAssociation
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "HistoryDatasetCollectionAssociation";
|
||||
@@ -3745,6 +3858,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default HistoryDatasetCollectionAssociation
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "HistoryDatasetCollectionAssociation";
|
||||
@@ -4135,6 +4250,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default History
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "History";
|
||||
@@ -4234,6 +4351,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default History
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "History";
|
||||
@@ -4296,6 +4415,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default ImplicitCollectionJobs
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model: "ImplicitCollectionJobs";
|
||||
@@ -4371,9 +4492,10 @@ export interface components {
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default ToolShedRepository
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class?: "ToolShedRepository";
|
||||
model_class: "ToolShedRepository";
|
||||
/**
|
||||
* Name
|
||||
* @description Name of repository
|
||||
@@ -4527,6 +4649,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default Job
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "Job";
|
||||
@@ -4586,6 +4710,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default Job
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model: "Job";
|
||||
@@ -4820,6 +4946,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default LibraryFolder
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "LibraryFolder";
|
||||
@@ -4930,6 +5058,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default Library
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "Library";
|
||||
@@ -5047,6 +5177,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default Library
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "Library";
|
||||
@@ -5203,6 +5335,96 @@ export interface components {
|
||||
*/
|
||||
time: string;
|
||||
};
|
||||
/** Model */
|
||||
Model: {
|
||||
/**
|
||||
* Access Methods
|
||||
* @description The list of access methods that can be used to fetch the `DrsObject`.
|
||||
* Required for single blobs; optional for bundles.
|
||||
*/
|
||||
access_methods?: components["schemas"]["AccessMethod"][];
|
||||
/**
|
||||
* Aliases
|
||||
* @description A list of strings that can be used to find other metadata about this `DrsObject` from external metadata sources. These aliases can be used to represent secondary accession numbers or external GUIDs.
|
||||
*/
|
||||
aliases?: string[];
|
||||
/**
|
||||
* Checksums
|
||||
* @description The checksum of the `DrsObject`. At least one checksum must be provided.
|
||||
* For blobs, the checksum is computed over the bytes in the blob.
|
||||
* For bundles, the checksum is computed over a sorted concatenation of the checksums of its top-level contained objects (not recursive, names not included). The list of checksums is sorted alphabetically (hex-code) before concatenation and a further checksum is performed on the concatenated checksum value.
|
||||
* For example, if a bundle contains blobs with the following checksums:
|
||||
* md5(blob1) = 72794b6d
|
||||
* md5(blob2) = 5e089d29
|
||||
* Then the checksum of the bundle is:
|
||||
* md5( concat( sort( md5(blob1), md5(blob2) ) ) )
|
||||
* = md5( concat( sort( 72794b6d, 5e089d29 ) ) )
|
||||
* = md5( concat( 5e089d29, 72794b6d ) )
|
||||
* = md5( 5e089d2972794b6d )
|
||||
* = f7a29a04
|
||||
*/
|
||||
checksums: components["schemas"]["Checksum"][];
|
||||
/**
|
||||
* Contents
|
||||
* @description If not set, this `DrsObject` is a single blob.
|
||||
* If set, this `DrsObject` is a bundle containing the listed `ContentsObject` s (some of which may be further nested).
|
||||
*/
|
||||
contents?: components["schemas"]["ContentsObject"][];
|
||||
/**
|
||||
* Created Time
|
||||
* Format: date-time
|
||||
* @description Timestamp of content creation in RFC3339.
|
||||
* (This is the creation time of the underlying content, not of the JSON object.)
|
||||
*/
|
||||
created_time: string;
|
||||
/**
|
||||
* Description
|
||||
* @description A human readable description of the `DrsObject`.
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Id
|
||||
* @description An identifier unique to this `DrsObject`
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Mime Type
|
||||
* @description A string providing the mime-type of the `DrsObject`.
|
||||
* @example application/json
|
||||
*/
|
||||
mime_type?: string;
|
||||
/**
|
||||
* Name
|
||||
* @description A string that can be used to name a `DrsObject`.
|
||||
* This string is made up of uppercase and lowercase letters, decimal digits, hypen, period, and underscore [A-Za-z0-9.-_]. See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282[portable filenames].
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Self Uri
|
||||
* @description A drs:// hostname-based URI, as defined in the DRS documentation, that tells clients how to access this object.
|
||||
* The intent of this field is to make DRS objects self-contained, and therefore easier for clients to store and pass around. For example, if you arrive at this DRS JSON by resolving a compact identifier-based DRS URI, the `self_uri` presents you with a hostname and properly encoded DRS ID for use in subsequent `access` endpoint calls.
|
||||
* @example drs://drs.example.org/314159
|
||||
*/
|
||||
self_uri: string;
|
||||
/**
|
||||
* Size
|
||||
* @description For blobs, the blob size in bytes.
|
||||
* For bundles, the cumulative size, in bytes, of items in the `contents` field.
|
||||
*/
|
||||
size: number;
|
||||
/**
|
||||
* Updated Time
|
||||
* Format: date-time
|
||||
* @description Timestamp of content update in RFC3339, identical to `created_time` in systems that do not support updates. (This is the update time of the underlying content, not of the JSON object.)
|
||||
*/
|
||||
updated_time?: string;
|
||||
/**
|
||||
* Version
|
||||
* @description A string representing a version.
|
||||
* (Some systems may use checksum, a RFC3339 timestamp, or an incrementing version number.)
|
||||
*/
|
||||
version?: string;
|
||||
};
|
||||
/**
|
||||
* ModelStoreFormat
|
||||
* @description Available types of model stores for export.
|
||||
@@ -5312,6 +5534,22 @@ export interface components {
|
||||
*/
|
||||
up_to_date: boolean;
|
||||
};
|
||||
/** Organization */
|
||||
Organization: {
|
||||
/**
|
||||
* Name
|
||||
* @description Name of the organization responsible for the service
|
||||
* @example My organization
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Url
|
||||
* Format: uri
|
||||
* @description URL of the website of the organization (RFC 3986 format)
|
||||
* @example https://example.com
|
||||
*/
|
||||
url: string;
|
||||
};
|
||||
/**
|
||||
* PageContentFormat
|
||||
* @description An enumeration.
|
||||
@@ -5373,6 +5611,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default Page
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "Page";
|
||||
@@ -5441,6 +5681,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default Page
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "Page";
|
||||
@@ -5698,6 +5940,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default Quota
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "Quota";
|
||||
@@ -5738,6 +5982,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default Quota
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "Quota";
|
||||
@@ -5840,6 +6086,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default Role
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "Role";
|
||||
@@ -5920,6 +6168,94 @@ export interface components {
|
||||
*/
|
||||
to_posix_lines?: boolean;
|
||||
};
|
||||
/** Service */
|
||||
Service: {
|
||||
/**
|
||||
* Contacturl
|
||||
* Format: uri
|
||||
* @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).
|
||||
* @example mailto:support@example.com
|
||||
*/
|
||||
contactUrl?: string;
|
||||
/**
|
||||
* Createdat
|
||||
* Format: date-time
|
||||
* @description Timestamp describing when the service was first deployed and available (RFC 3339 format)
|
||||
* @example 2019-06-04T12:58:19Z
|
||||
*/
|
||||
createdAt?: string;
|
||||
/**
|
||||
* Description
|
||||
* @description Description of the service. Should be human readable and provide information about the service.
|
||||
* @example This service provides...
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Documentationurl
|
||||
* Format: uri
|
||||
* @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.
|
||||
* @example https://docs.myservice.example.com
|
||||
*/
|
||||
documentationUrl?: string;
|
||||
/**
|
||||
* Environment
|
||||
* @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.
|
||||
* @example test
|
||||
*/
|
||||
environment?: string;
|
||||
/**
|
||||
* Id
|
||||
* @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.
|
||||
* @example org.ga4gh.myservice
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Name
|
||||
* @description Name of this service. Should be human readable.
|
||||
* @example My project
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Organization
|
||||
* @description Organization providing the service
|
||||
*/
|
||||
organization: components["schemas"]["Organization"];
|
||||
type: components["schemas"]["ServiceType"];
|
||||
/**
|
||||
* Updatedat
|
||||
* Format: date-time
|
||||
* @description Timestamp describing when the service was last updated (RFC 3339 format)
|
||||
* @example 2019-06-04T12:58:19Z
|
||||
*/
|
||||
updatedAt?: string;
|
||||
/**
|
||||
* Version
|
||||
* @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.
|
||||
* @example 1.0.0
|
||||
*/
|
||||
version: string;
|
||||
};
|
||||
/** ServiceType */
|
||||
ServiceType: {
|
||||
/**
|
||||
* Artifact
|
||||
* @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.
|
||||
* @example beacon
|
||||
*/
|
||||
artifact: string;
|
||||
/**
|
||||
* Group
|
||||
* @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).
|
||||
* @example org.ga4gh
|
||||
*/
|
||||
group: string;
|
||||
/**
|
||||
* Version
|
||||
* @description Version of the API or specification. GA4GH specifications use semantic versioning.
|
||||
* @example 1.0.0
|
||||
*/
|
||||
version: string;
|
||||
};
|
||||
/**
|
||||
* SetSlugPayload
|
||||
* @description Base model definition with common configuration used by all derived models.
|
||||
@@ -6407,6 +6743,12 @@ export interface components {
|
||||
*/
|
||||
title?: string;
|
||||
};
|
||||
/**
|
||||
* Type
|
||||
* @description An enumeration.
|
||||
* @enum {unknown}
|
||||
*/
|
||||
Type: "s3" | "gs" | "ftp" | "gsiftp" | "globus" | "htsget" | "https" | "file";
|
||||
/**
|
||||
* UpdateCollectionAttributePayload
|
||||
* @description Contains attributes that can be updated for all elements in a dataset collection.
|
||||
@@ -6652,6 +6994,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default User
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "User";
|
||||
@@ -6669,6 +7013,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default UserQuotaAssociation
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model_class: "UserQuotaAssociation";
|
||||
@@ -6705,6 +7051,8 @@ export interface components {
|
||||
/**
|
||||
* Model class
|
||||
* @description The name of the database model class.
|
||||
* @default WorkflowInvocation
|
||||
* @constant
|
||||
* @enum {string}
|
||||
*/
|
||||
model: "WorkflowInvocation";
|
||||
@@ -7961,6 +8309,29 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
download_api_drs_download__object_id__get: {
|
||||
/** Download */
|
||||
parameters: {
|
||||
/** @description The user ID that will be used to effectively make this API call. Only admins and designated users can make API calls on behalf of other users. */
|
||||
header?: {
|
||||
"run-as"?: string;
|
||||
};
|
||||
/** @description The ID of the group */
|
||||
path: {
|
||||
object_id: string;
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description Successful Response */
|
||||
200: never;
|
||||
/** @description Validation Error */
|
||||
422: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["HTTPValidationError"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
index_api_folders__folder_id__contents_get: {
|
||||
/**
|
||||
* Returns a list of a folder's contents (files and sub-folders) with additional metadata about the folder.
|
||||
@@ -9058,10 +9429,7 @@ export interface operations {
|
||||
/** @description Successful Response */
|
||||
200: {
|
||||
content: {
|
||||
"application/json":
|
||||
| components["schemas"]["HistorySummary"]
|
||||
| components["schemas"]["HistoryDetailed"]
|
||||
| Record<string, never>;
|
||||
"application/json": components["schemas"]["AsyncTaskResultSummary"];
|
||||
};
|
||||
};
|
||||
/** @description Validation Error */
|
||||
@@ -13965,4 +14333,127 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
get_object_ga4gh_drs_v1_objects__object_id__get: {
|
||||
/** Get Object */
|
||||
parameters: {
|
||||
/** @description The user ID that will be used to effectively make this API call. Only admins and designated users can make API calls on behalf of other users. */
|
||||
header?: {
|
||||
"run-as"?: string;
|
||||
};
|
||||
/** @description The ID of the group */
|
||||
path: {
|
||||
object_id: string;
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description Successful Response */
|
||||
200: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["Model"];
|
||||
};
|
||||
};
|
||||
/** @description Validation Error */
|
||||
422: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["HTTPValidationError"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
get_object_ga4gh_drs_v1_objects__object_id__post: {
|
||||
/** Get Object */
|
||||
parameters: {
|
||||
/** @description The user ID that will be used to effectively make this API call. Only admins and designated users can make API calls on behalf of other users. */
|
||||
header?: {
|
||||
"run-as"?: string;
|
||||
};
|
||||
/** @description The ID of the group */
|
||||
path: {
|
||||
object_id: string;
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description Successful Response */
|
||||
200: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["Model"];
|
||||
};
|
||||
};
|
||||
/** @description Validation Error */
|
||||
422: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["HTTPValidationError"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
get_access_url_ga4gh_drs_v1_objects__object_id__access__access_id__get: {
|
||||
/** Get Access Url */
|
||||
parameters: {
|
||||
/** @description The user ID that will be used to effectively make this API call. Only admins and designated users can make API calls on behalf of other users. */
|
||||
header?: {
|
||||
"run-as"?: string;
|
||||
};
|
||||
/** @description The ID of the group */
|
||||
/** @description The access ID of the access method for objects, unused in Galaxy. */
|
||||
path: {
|
||||
object_id: string;
|
||||
access_id: string;
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description Successful Response */
|
||||
200: {
|
||||
content: {
|
||||
"application/json": Record<string, never>;
|
||||
};
|
||||
};
|
||||
/** @description Validation Error */
|
||||
422: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["HTTPValidationError"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
get_access_url_ga4gh_drs_v1_objects__object_id__access__access_id__post: {
|
||||
/** Get Access Url */
|
||||
parameters: {
|
||||
/** @description The user ID that will be used to effectively make this API call. Only admins and designated users can make API calls on behalf of other users. */
|
||||
header?: {
|
||||
"run-as"?: string;
|
||||
};
|
||||
/** @description The ID of the group */
|
||||
/** @description The access ID of the access method for objects, unused in Galaxy. */
|
||||
path: {
|
||||
object_id: string;
|
||||
access_id: string;
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description Successful Response */
|
||||
200: {
|
||||
content: {
|
||||
"application/json": Record<string, never>;
|
||||
};
|
||||
};
|
||||
/** @description Validation Error */
|
||||
422: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["HTTPValidationError"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
service_info_ga4gh_drs_v1_service_info_get: {
|
||||
/** Service Info */
|
||||
responses: {
|
||||
/** @description Successful Response */
|
||||
200: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["Service"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,10 +5,7 @@ from typing import (
|
||||
)
|
||||
|
||||
from pydantic import Field
|
||||
from typing_extensions import (
|
||||
Annotated,
|
||||
Literal,
|
||||
)
|
||||
from typing_extensions import Literal
|
||||
|
||||
from galaxy.schema.fields import (
|
||||
DecodedDatabaseIdField,
|
||||
@@ -70,7 +67,7 @@ QuotaOperationField = Field(
|
||||
|
||||
|
||||
class DefaultQuota(Model): # TODO: should this replace lib.galaxy.model.DefaultQuotaAssociation at some point?
|
||||
model_class: Annotated[DEFAULT_QUOTA_ASSOCIATION, ModelClassField()]
|
||||
model_class: DEFAULT_QUOTA_ASSOCIATION = ModelClassField(DEFAULT_QUOTA_ASSOCIATION)
|
||||
type: DefaultQuotaTypes = Field(
|
||||
...,
|
||||
title="Type",
|
||||
@@ -83,7 +80,7 @@ class DefaultQuota(Model): # TODO: should this replace lib.galaxy.model.Default
|
||||
|
||||
|
||||
class UserQuota(Model):
|
||||
model_class: Annotated[USER_QUOTA_ASSOCIATION, ModelClassField()]
|
||||
model_class: USER_QUOTA_ASSOCIATION = ModelClassField(USER_QUOTA_ASSOCIATION)
|
||||
user: UserModel = Field(
|
||||
...,
|
||||
title="User",
|
||||
@@ -92,7 +89,7 @@ class UserQuota(Model):
|
||||
|
||||
|
||||
class GroupQuota(Model):
|
||||
model_class: Annotated[GROUP_QUOTA_ASSOCIATION, ModelClassField()]
|
||||
model_class: GROUP_QUOTA_ASSOCIATION = ModelClassField(GROUP_QUOTA_ASSOCIATION)
|
||||
group: GroupModel = Field(
|
||||
...,
|
||||
title="Group",
|
||||
@@ -103,7 +100,7 @@ class GroupQuota(Model):
|
||||
class QuotaBase(Model):
|
||||
"""Base model containing common fields for Quotas."""
|
||||
|
||||
model_class: Annotated[QUOTA, ModelClassField()]
|
||||
model_class: QUOTA = ModelClassField(QUOTA)
|
||||
id: DecodedDatabaseIdField = Field(
|
||||
...,
|
||||
title="ID",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import re
|
||||
|
||||
from pydantic import Field
|
||||
from typing_extensions import get_args
|
||||
|
||||
from galaxy.security.idencoding import IdEncodingHelper
|
||||
|
||||
@@ -94,13 +95,25 @@ class EncodedDatabaseIdField(str, BaseDatabaseIdField):
|
||||
return cls.security.decode_id(v)
|
||||
|
||||
|
||||
def ModelClassField():
|
||||
def literal_to_value(arg):
|
||||
val = get_args(arg)
|
||||
if not val:
|
||||
return arg
|
||||
if len(val) > 1:
|
||||
raise Exception("Can't extract default argument for unions")
|
||||
return val[0]
|
||||
|
||||
|
||||
def ModelClassField(default_value=...):
|
||||
"""Represents a database model class name annotated as a constant
|
||||
pydantic Field.
|
||||
:param class_name: The name of the database class.
|
||||
:return: A constant pydantic Field with default annotations for model classes.
|
||||
"""
|
||||
return Field(
|
||||
literal_to_value(default_value),
|
||||
title="Model class",
|
||||
description="The name of the database model class.",
|
||||
const=True,
|
||||
mark_required_in_schema=True,
|
||||
)
|
||||
|
||||
+34
-18
@@ -195,6 +195,22 @@ class Model(BaseModel):
|
||||
LibraryFolderDatabaseIdField: lambda v: LibraryFolderDatabaseIdField.encode(v),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def schema_extra(schema: Dict[str, Any], model) -> None:
|
||||
# pydantic doesn't currently allow creating a constant that isn't optional,
|
||||
# which makes sense for validation, but an openapi schema that describes
|
||||
# a response should be able to declare that a field is always present,
|
||||
# even if it is generated from a default value.
|
||||
# Pass `mark_required_in_schema=True` when constructing a pydantic Field instance
|
||||
# to indicate that the field is always present.
|
||||
for prop_key, prop in schema.get("properties", {}).items():
|
||||
required_in_schema = prop.pop("mark_required_in_schema", None)
|
||||
if required_in_schema:
|
||||
if "required" in schema:
|
||||
schema["required"].append(prop_key)
|
||||
else:
|
||||
schema["required"] = [prop_key]
|
||||
|
||||
|
||||
class UserModel(Model):
|
||||
"""User in a transaction context."""
|
||||
@@ -205,13 +221,13 @@ class UserModel(Model):
|
||||
active: bool = Field(title="Active", description="User is active")
|
||||
deleted: bool = Field(title="Deleted", description="User is deleted")
|
||||
last_password_change: Optional[datetime] = Field(title="Last password change", description="")
|
||||
model_class: Annotated[USER_MODEL_CLASS, ModelClassField()]
|
||||
model_class: USER_MODEL_CLASS = ModelClassField(USER_MODEL_CLASS)
|
||||
|
||||
|
||||
class GroupModel(Model):
|
||||
"""User group model"""
|
||||
|
||||
model_class: Annotated[GROUP_MODEL_CLASS, ModelClassField()]
|
||||
model_class: GROUP_MODEL_CLASS = ModelClassField(GROUP_MODEL_CLASS)
|
||||
id: DecodedDatabaseIdField = Field(
|
||||
..., # Required
|
||||
title="ID",
|
||||
@@ -603,7 +619,7 @@ class HDAExtended(HDADetailed):
|
||||
class DCSummary(Model):
|
||||
"""Dataset Collection summary information."""
|
||||
|
||||
model_class: Annotated[DC_MODEL_CLASS, ModelClassField()]
|
||||
model_class: DC_MODEL_CLASS = ModelClassField(DC_MODEL_CLASS)
|
||||
id: DecodedDatabaseIdField = EntityIdField
|
||||
create_time: datetime = CreateTimeField
|
||||
update_time: datetime = UpdateTimeField
|
||||
@@ -617,7 +633,7 @@ class HDAObject(Model):
|
||||
"""History Dataset Association Object"""
|
||||
|
||||
id: DecodedDatabaseIdField = EntityIdField
|
||||
model_class: Annotated[HDA_MODEL_CLASS, ModelClassField()]
|
||||
model_class: HDA_MODEL_CLASS = ModelClassField(HDA_MODEL_CLASS)
|
||||
state: Dataset.states = DatasetStateField
|
||||
hda_ldda: DatasetSourceType = HdaLddaField
|
||||
history_id: DecodedDatabaseIdField = HistoryIdField
|
||||
@@ -630,7 +646,7 @@ class DCObject(Model):
|
||||
"""Dataset Collection Object"""
|
||||
|
||||
id: DecodedDatabaseIdField = EntityIdField
|
||||
model_class: Annotated[DC_MODEL_CLASS, ModelClassField()]
|
||||
model_class: DC_MODEL_CLASS = ModelClassField(DC_MODEL_CLASS)
|
||||
collection_type: CollectionType = CollectionTypeField
|
||||
populated: Optional[bool] = PopulatedField
|
||||
element_count: Optional[int] = ElementCountField
|
||||
@@ -642,7 +658,7 @@ class DCESummary(Model):
|
||||
"""Dataset Collection Element summary information."""
|
||||
|
||||
id: DecodedDatabaseIdField = EntityIdField
|
||||
model_class: Annotated[DCE_MODEL_CLASS, ModelClassField()]
|
||||
model_class: DCE_MODEL_CLASS = ModelClassField(DCE_MODEL_CLASS)
|
||||
element_index: int = Field(
|
||||
...,
|
||||
title="Element Index",
|
||||
@@ -748,7 +764,7 @@ class HDCJobStateSummary(Model):
|
||||
class HDCASummary(HistoryItemCommon):
|
||||
"""History Dataset Collection Association summary information."""
|
||||
|
||||
model_class: Annotated[HDCA_MODEL_CLASS, ModelClassField()]
|
||||
model_class: HDCA_MODEL_CLASS = ModelClassField(HDCA_MODEL_CLASS)
|
||||
type: Annotated[
|
||||
Literal["collection"],
|
||||
Field(
|
||||
@@ -906,7 +922,7 @@ class UpdateHistoryContentsPayload(HistoryBase):
|
||||
class HistorySummary(HistoryBase):
|
||||
"""History summary information."""
|
||||
|
||||
model_class: Annotated[HISTORY_MODEL_CLASS, ModelClassField()]
|
||||
model_class: HISTORY_MODEL_CLASS = ModelClassField(HISTORY_MODEL_CLASS)
|
||||
id: DecodedDatabaseIdField = EntityIdField
|
||||
name: str = Field(
|
||||
...,
|
||||
@@ -1485,7 +1501,7 @@ class JobIdResponse(Model):
|
||||
|
||||
class JobBaseModel(Model):
|
||||
id: DecodedDatabaseIdField = EntityIdField
|
||||
model_class: Annotated[JOB_MODEL_CLASS, ModelClassField()]
|
||||
model_class: JOB_MODEL_CLASS = ModelClassField(JOB_MODEL_CLASS)
|
||||
tool_id: str = Field(
|
||||
...,
|
||||
title="Tool ID",
|
||||
@@ -1533,15 +1549,15 @@ class ItemStateSummary(Model):
|
||||
|
||||
|
||||
class JobStateSummary(ItemStateSummary):
|
||||
model: Annotated[Literal["Job"], ModelClassField()]
|
||||
model: Literal["Job"] = ModelClassField("Job")
|
||||
|
||||
|
||||
class ImplicitCollectionJobsStateSummary(ItemStateSummary):
|
||||
model: Annotated[Literal["ImplicitCollectionJobs"], ModelClassField()]
|
||||
model: Literal["ImplicitCollectionJobs"] = ModelClassField("ImplicitCollectionJobs")
|
||||
|
||||
|
||||
class WorkflowInvocationStateSummary(ItemStateSummary):
|
||||
model: Annotated[Literal["WorkflowInvocation"], ModelClassField()]
|
||||
model: Literal["WorkflowInvocation"] = ModelClassField("WorkflowInvocation")
|
||||
|
||||
|
||||
class JobSummary(JobBaseModel):
|
||||
@@ -1708,7 +1724,7 @@ class JobFullDetails(JobDetails):
|
||||
|
||||
class StoredWorkflowSummary(Model):
|
||||
id: DecodedDatabaseIdField = EntityIdField
|
||||
model_class: Annotated[STORED_WORKFLOW_MODEL_CLASS, ModelClassField()]
|
||||
model_class: STORED_WORKFLOW_MODEL_CLASS = ModelClassField(STORED_WORKFLOW_MODEL_CLASS)
|
||||
create_time: datetime = CreateTimeField
|
||||
update_time: datetime = UpdateTimeField
|
||||
name: str = Field(
|
||||
@@ -2197,7 +2213,7 @@ class BasicRoleModel(Model):
|
||||
class RoleModel(BasicRoleModel):
|
||||
description: Optional[str] = RoleDescriptionField
|
||||
url: RelativeUrl = RelativeUrlField
|
||||
model_class: Annotated[Literal["Role"], ModelClassField()]
|
||||
model_class: Literal["Role"] = ModelClassField("Role")
|
||||
|
||||
|
||||
class RoleDefinitionModel(Model):
|
||||
@@ -2273,7 +2289,7 @@ class InstalledRepositoryToolShedStatus(Model):
|
||||
|
||||
|
||||
class InstalledToolShedRepository(Model):
|
||||
model_class: Annotated[Literal["ToolShedRepository"], ModelClassField()] = "ToolShedRepository"
|
||||
model_class: Literal["ToolShedRepository"] = ModelClassField("ToolShedRepository")
|
||||
id: EncodedDatabaseIdField = Field(
|
||||
...,
|
||||
title="ID",
|
||||
@@ -2327,7 +2343,7 @@ class LibraryPermissionScope(str, Enum):
|
||||
|
||||
|
||||
class LibraryLegacySummary(Model):
|
||||
model_class: Annotated[Literal["Library"], ModelClassField()]
|
||||
model_class: Literal["Library"] = ModelClassField("Library")
|
||||
id: DecodedDatabaseIdField = Field(
|
||||
...,
|
||||
title="ID",
|
||||
@@ -2574,7 +2590,7 @@ class LibraryFolderPermissionsPayload(LibraryPermissionsPayloadBase):
|
||||
|
||||
|
||||
class LibraryFolderDetails(Model):
|
||||
model_class: Annotated[Literal["LibraryFolder"], ModelClassField()]
|
||||
model_class: Literal["LibraryFolder"] = ModelClassField("LibraryFolder")
|
||||
id: LibraryFolderDatabaseIdField = Field(
|
||||
...,
|
||||
title="ID",
|
||||
@@ -3195,7 +3211,7 @@ class PageSummary(PageSummaryBase):
|
||||
title="ID",
|
||||
description="Encoded ID of the Page.",
|
||||
)
|
||||
model_class: Annotated[PAGE_MODEL_CLASS, ModelClassField()]
|
||||
model_class: PAGE_MODEL_CLASS = ModelClassField(PAGE_MODEL_CLASS)
|
||||
username: str = Field(
|
||||
..., # Required
|
||||
title="Username",
|
||||
|
||||
@@ -324,7 +324,7 @@ class FastAPIHistories:
|
||||
self,
|
||||
trans: ProvidesHistoryContext = DependsOnTrans,
|
||||
payload: CreateHistoryFromStore = Body(...),
|
||||
) -> AnyHistoryView:
|
||||
) -> AsyncTaskResultSummary:
|
||||
return self.service.create_from_store_async(trans, payload)
|
||||
|
||||
@router.get(
|
||||
|
||||
@@ -12,10 +12,7 @@ from pydantic import (
|
||||
Field,
|
||||
ValidationError,
|
||||
)
|
||||
from typing_extensions import (
|
||||
Annotated,
|
||||
Literal,
|
||||
)
|
||||
from typing_extensions import Literal
|
||||
|
||||
from galaxy import exceptions
|
||||
from galaxy.datatypes.registry import Registry
|
||||
@@ -68,7 +65,7 @@ class DatasetCollectionAttributesResult(Model):
|
||||
dbkey: str = Field(..., description="TODO")
|
||||
# Are the following fields really used/needed?
|
||||
extension: str = Field(..., description="The dataset file extension.", example="txt")
|
||||
model_class: Annotated[Literal["HistoryDatasetCollectionAssociation"], ModelClassField()]
|
||||
model_class: Literal["HistoryDatasetCollectionAssociation"] = ModelClassField("HistoryDatasetCollectionAssociation")
|
||||
dbkeys: Optional[Set[str]]
|
||||
extensions: Optional[Set[str]]
|
||||
tags: TagCollection
|
||||
|
||||
Reference in New Issue
Block a user