From 2f65f626ab2c6dc7e0f9f2c48bc47e6a6b74c78e Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Wed, 28 Aug 2024 14:56:07 +0100 Subject: [PATCH 1/7] Add graphql description tag to every method and argument in graphql/model.rs --- thoth-api/src/graphql/model.rs | 617 ++++++++++++++++++++++++++++----- 1 file changed, 532 insertions(+), 85 deletions(-) diff --git a/thoth-api/src/graphql/model.rs b/thoth-api/src/graphql/model.rs index 3935150dc..fdddc3e6d 100644 --- a/thoth-api/src/graphql/model.rs +++ b/thoth-api/src/graphql/model.rs @@ -226,13 +226,19 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single work using its id")] - fn work(context: &Context, work_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single work using its ID")] + fn work( + context: &Context, + #[graphql(description = "Thoth work ID to search on")] work_id: Uuid, + ) -> FieldResult { Work::from_id(&context.db, &work_id).map_err(|e| e.into()) } #[graphql(description = "Query a single work using its DOI")] - fn work_by_doi(context: &Context, doi: Doi) -> FieldResult { + fn work_by_doi( + context: &Context, + #[graphql(description = "Work DOI to search on")] doi: Doi, + ) -> FieldResult { Work::from_doi(&context.db, doi, vec![]).map_err(|e| e.into()) } @@ -342,7 +348,10 @@ impl QueryRoot { } #[graphql(description = "Query a single book using its DOI")] - fn book_by_doi(context: &Context, doi: Doi) -> FieldResult { + fn book_by_doi( + context: &Context, + #[graphql(description = "Book DOI to search on")] doi: Doi, + ) -> FieldResult { Work::from_doi( &context.db, doi, @@ -459,7 +468,10 @@ impl QueryRoot { } #[graphql(description = "Query a single chapter using its DOI")] - fn chapter_by_doi(context: &Context, doi: Doi) -> FieldResult { + fn chapter_by_doi( + context: &Context, + #[graphql(description = "Chapter DOI to search on")] doi: Doi, + ) -> FieldResult { Work::from_doi(&context.db, doi, vec![WorkType::BookChapter]).map_err(|e| e.into()) } @@ -548,8 +560,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single publication using its id")] - fn publication(context: &Context, publication_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single publication using its ID")] + fn publication( + context: &Context, + #[graphql(description = "Thoth publication ID to search on")] publication_id: Uuid, + ) -> FieldResult { Publication::from_id(&context.db, &publication_id).map_err(|e| e.into()) } @@ -620,8 +635,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single publisher using its id")] - fn publisher(context: &Context, publisher_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single publisher using its ID")] + fn publisher( + context: &Context, + #[graphql(description = "Thoth publisher ID to search on")] publisher_id: Uuid, + ) -> FieldResult { Publisher::from_id(&context.db, &publisher_id).map_err(|e| e.into()) } @@ -687,8 +705,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single imprint using its id")] - fn imprint(context: &Context, imprint_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single imprint using its ID")] + fn imprint( + context: &Context, + #[graphql(description = "Thoth imprint ID to search on")] imprint_id: Uuid, + ) -> FieldResult { Imprint::from_id(&context.db, &imprint_id).map_err(|e| e.into()) } @@ -749,8 +770,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single contributor using its id")] - fn contributor(context: &Context, contributor_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single contributor using its ID")] + fn contributor( + context: &Context, + #[graphql(description = "Thoth contributor ID to search on")] contributor_id: Uuid, + ) -> FieldResult { Contributor::from_id(&context.db, &contributor_id).map_err(|e| e.into()) } @@ -803,8 +827,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single contribution using its id")] - fn contribution(context: &Context, contribution_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single contribution using its ID")] + fn contribution( + context: &Context, + #[graphql(description = "Thoth contribution ID to search on")] contribution_id: Uuid, + ) -> FieldResult { Contribution::from_id(&context.db, &contribution_id).map_err(|e| e.into()) } @@ -870,8 +897,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single series using its id")] - fn series(context: &Context, series_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single series using its ID")] + fn series( + context: &Context, + #[graphql(description = "Thoth series ID to search on")] series_id: Uuid, + ) -> FieldResult { Series::from_id(&context.db, &series_id).map_err(|e| e.into()) } @@ -937,8 +967,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single issue using its id")] - fn issue(context: &Context, issue_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single issue using its ID")] + fn issue( + context: &Context, + #[graphql(description = "Thoth issue ID to search on")] issue_id: Uuid, + ) -> FieldResult { Issue::from_id(&context.db, &issue_id).map_err(|e| e.into()) } @@ -998,8 +1031,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single language using its id")] - fn language(context: &Context, language_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single language using its ID")] + fn language( + context: &Context, + #[graphql(description = "Thoth language ID to search on")] language_id: Uuid, + ) -> FieldResult { Language::from_id(&context.db, &language_id).map_err(|e| e.into()) } @@ -1073,8 +1109,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single location using its id")] - fn location(context: &Context, location_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single location using its ID")] + fn location( + context: &Context, + #[graphql(description = "Thoth location ID to search on")] location_id: Uuid, + ) -> FieldResult { Location::from_id(&context.db, &location_id).map_err(|e| e.into()) } @@ -1135,8 +1174,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single price using its id")] - fn price(context: &Context, price_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single price using its ID")] + fn price( + context: &Context, + #[graphql(description = "Thoth price ID to search on")] price_id: Uuid, + ) -> FieldResult { Price::from_id(&context.db, &price_id).map_err(|e| e.into()) } @@ -1202,8 +1244,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single subject using its id")] - fn subject(context: &Context, subject_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single subject using its ID")] + fn subject( + context: &Context, + #[graphql(description = "Thoth subject ID to search on")] subject_id: Uuid, + ) -> FieldResult { Subject::from_id(&context.db, &subject_id).map_err(|e| e.into()) } @@ -1264,8 +1309,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single institution using its id")] - fn institution(context: &Context, institution_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single institution using its ID")] + fn institution( + context: &Context, + #[graphql(description = "Thoth institution ID to search on")] institution_id: Uuid, + ) -> FieldResult { Institution::from_id(&context.db, &institution_id).map_err(|e| e.into()) } @@ -1313,8 +1361,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single funding using its id")] - fn funding(context: &Context, funding_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single funding using its ID")] + fn funding( + context: &Context, + #[graphql(description = "Thoth funding ID to search on")] funding_id: Uuid, + ) -> FieldResult { Funding::from_id(&context.db, &funding_id).map_err(|e| e.into()) } @@ -1355,8 +1406,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single affiliation using its id")] - fn affiliation(context: &Context, affiliation_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single affiliation using its ID")] + fn affiliation( + context: &Context, + #[graphql(description = "Thoth affiliation ID to search on")] affiliation_id: Uuid, + ) -> FieldResult { Affiliation::from_id(&context.db, &affiliation_id).map_err(|e| e.into()) } @@ -1397,8 +1451,11 @@ impl QueryRoot { .map_err(|e| e.into()) } - #[graphql(description = "Query a single reference using its id")] - fn reference(context: &Context, reference_id: Uuid) -> FieldResult { + #[graphql(description = "Query a single reference using its ID")] + fn reference( + context: &Context, + #[graphql(description = "Thoth reference ID to search on")] reference_id: Uuid, + ) -> FieldResult { Reference::from_id(&context.db, &reference_id).map_err(|e| e.into()) } @@ -1412,7 +1469,11 @@ pub struct MutationRoot; #[juniper::graphql_object(Context = Context)] impl MutationRoot { - fn create_work(context: &Context, data: NewWork) -> FieldResult { + #[graphql(description = "Create a new work with the specified values")] + fn create_work( + context: &Context, + #[graphql(description = "Values for work to be created")] data: NewWork, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1423,7 +1484,11 @@ impl MutationRoot { Work::create(&context.db, &data).map_err(|e| e.into()) } - fn create_publisher(context: &Context, data: NewPublisher) -> FieldResult { + #[graphql(description = "Create a new publisher with the specified values")] + fn create_publisher( + context: &Context, + #[graphql(description = "Values for publisher to be created")] data: NewPublisher, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; // Only superusers can create new publishers - NewPublisher has no ID field if !context.account_access.is_superuser { @@ -1433,19 +1498,31 @@ impl MutationRoot { Publisher::create(&context.db, &data).map_err(|e| e.into()) } - fn create_imprint(context: &Context, data: NewImprint) -> FieldResult { + #[graphql(description = "Create a new imprint with the specified values")] + fn create_imprint( + context: &Context, + #[graphql(description = "Values for imprint to be created")] data: NewImprint, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context.account_access.can_edit(data.publisher_id)?; Imprint::create(&context.db, &data).map_err(|e| e.into()) } - fn create_contributor(context: &Context, data: NewContributor) -> FieldResult { + #[graphql(description = "Create a new contributor with the specified values")] + fn create_contributor( + context: &Context, + #[graphql(description = "Values for contributor to be created")] data: NewContributor, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; Contributor::create(&context.db, &data).map_err(|e| e.into()) } - fn create_contribution(context: &Context, data: NewContribution) -> FieldResult { + #[graphql(description = "Create a new contribution with the specified values")] + fn create_contribution( + context: &Context, + #[graphql(description = "Values for contribution to be created")] data: NewContribution, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1454,7 +1531,11 @@ impl MutationRoot { Contribution::create(&context.db, &data).map_err(|e| e.into()) } - fn create_publication(context: &Context, data: NewPublication) -> FieldResult { + #[graphql(description = "Create a new publication with the specified values")] + fn create_publication( + context: &Context, + #[graphql(description = "Values for publication to be created")] data: NewPublication, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1465,7 +1546,11 @@ impl MutationRoot { Publication::create(&context.db, &data).map_err(|e| e.into()) } - fn create_series(context: &Context, data: NewSeries) -> FieldResult { + #[graphql(description = "Create a new series with the specified values")] + fn create_series( + context: &Context, + #[graphql(description = "Values for series to be created")] data: NewSeries, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1474,7 +1559,11 @@ impl MutationRoot { Series::create(&context.db, &data).map_err(|e| e.into()) } - fn create_issue(context: &Context, data: NewIssue) -> FieldResult { + #[graphql(description = "Create a new issue with the specified values")] + fn create_issue( + context: &Context, + #[graphql(description = "Values for issue to be created")] data: NewIssue, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1485,7 +1574,11 @@ impl MutationRoot { Issue::create(&context.db, &data).map_err(|e| e.into()) } - fn create_language(context: &Context, data: NewLanguage) -> FieldResult { + #[graphql(description = "Create a new language with the specified values")] + fn create_language( + context: &Context, + #[graphql(description = "Values for language to be created")] data: NewLanguage, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1494,12 +1587,20 @@ impl MutationRoot { Language::create(&context.db, &data).map_err(|e| e.into()) } - fn create_institution(context: &Context, data: NewInstitution) -> FieldResult { + #[graphql(description = "Create a new institution with the specified values")] + fn create_institution( + context: &Context, + #[graphql(description = "Values for institution to be created")] data: NewInstitution, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; Institution::create(&context.db, &data).map_err(|e| e.into()) } - fn create_funding(context: &Context, data: NewFunding) -> FieldResult { + #[graphql(description = "Create a new funding with the specified values")] + fn create_funding( + context: &Context, + #[graphql(description = "Values for funding to be created")] data: NewFunding, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1508,7 +1609,11 @@ impl MutationRoot { Funding::create(&context.db, &data).map_err(|e| e.into()) } - fn create_location(context: &Context, data: NewLocation) -> FieldResult { + #[graphql(description = "Create a new location with the specified values")] + fn create_location( + context: &Context, + #[graphql(description = "Values for location to be created")] data: NewLocation, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1526,7 +1631,11 @@ impl MutationRoot { Location::create(&context.db, &data).map_err(|e| e.into()) } - fn create_price(context: &Context, data: NewPrice) -> FieldResult { + #[graphql(description = "Create a new price with the specified values")] + fn create_price( + context: &Context, + #[graphql(description = "Values for price to be created")] data: NewPrice, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1543,7 +1652,11 @@ impl MutationRoot { Price::create(&context.db, &data).map_err(|e| e.into()) } - fn create_subject(context: &Context, data: NewSubject) -> FieldResult { + #[graphql(description = "Create a new subject with the specified values")] + fn create_subject( + context: &Context, + #[graphql(description = "Values for subject to be created")] data: NewSubject, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1554,7 +1667,11 @@ impl MutationRoot { Subject::create(&context.db, &data).map_err(|e| e.into()) } - fn create_affiliation(context: &Context, data: NewAffiliation) -> FieldResult { + #[graphql(description = "Create a new affiliation with the specified values")] + fn create_affiliation( + context: &Context, + #[graphql(description = "Values for affiliation to be created")] data: NewAffiliation, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1566,7 +1683,11 @@ impl MutationRoot { Affiliation::create(&context.db, &data).map_err(|e| e.into()) } - fn create_work_relation(context: &Context, data: NewWorkRelation) -> FieldResult { + #[graphql(description = "Create a new work relation with the specified values")] + fn create_work_relation( + context: &Context, + #[graphql(description = "Values for work relation to be created")] data: NewWorkRelation, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; // Work relations may link works from different publishers. // User must have permissions for all relevant publishers. @@ -1582,7 +1703,11 @@ impl MutationRoot { WorkRelation::create(&context.db, &data).map_err(|e| e.into()) } - fn create_reference(context: &Context, data: NewReference) -> FieldResult { + #[graphql(description = "Create a new reference with the specified values")] + fn create_reference( + context: &Context, + #[graphql(description = "Values for reference to be created")] data: NewReference, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; context .account_access @@ -1591,7 +1716,11 @@ impl MutationRoot { Reference::create(&context.db, &data).map_err(|e| e.into()) } - fn update_work(context: &Context, data: PatchWork) -> FieldResult { + #[graphql(description = "Update an existing work with the specified values")] + fn update_work( + context: &Context, + #[graphql(description = "Values to apply to existing work")] data: PatchWork, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let work = Work::from_id(&context.db, &data.work_id).unwrap(); context @@ -1633,7 +1762,11 @@ impl MutationRoot { } } - fn update_publisher(context: &Context, data: PatchPublisher) -> FieldResult { + #[graphql(description = "Update an existing publisher with the specified values")] + fn update_publisher( + context: &Context, + #[graphql(description = "Values to apply to existing publisher")] data: PatchPublisher, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let publisher = Publisher::from_id(&context.db, &data.publisher_id).unwrap(); context.account_access.can_edit(publisher.publisher_id)?; @@ -1647,7 +1780,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_imprint(context: &Context, data: PatchImprint) -> FieldResult { + #[graphql(description = "Update an existing imprint with the specified values")] + fn update_imprint( + context: &Context, + #[graphql(description = "Values to apply to existing imprint")] data: PatchImprint, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let imprint = Imprint::from_id(&context.db, &data.imprint_id).unwrap(); context.account_access.can_edit(imprint.publisher_id())?; @@ -1661,7 +1798,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_contributor(context: &Context, data: PatchContributor) -> FieldResult { + #[graphql(description = "Update an existing contributor with the specified values")] + fn update_contributor( + context: &Context, + #[graphql(description = "Values to apply to existing contributor")] data: PatchContributor, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let account_id = context.token.jwt.as_ref().unwrap().account_id(&context.db); Contributor::from_id(&context.db, &data.contributor_id) @@ -1670,8 +1811,10 @@ impl MutationRoot { .map_err(|e| e.into()) } + #[graphql(description = "Update an existing contribution with the specified values")] fn update_contribution( context: &Context, + #[graphql(description = "Values to apply to existing contribution")] data: PatchContribution, ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; @@ -1691,7 +1834,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_publication(context: &Context, data: PatchPublication) -> FieldResult { + #[graphql(description = "Update an existing publication with the specified values")] + fn update_publication( + context: &Context, + #[graphql(description = "Values to apply to existing publication")] data: PatchPublication, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let publication = Publication::from_id(&context.db, &data.publication_id).unwrap(); context @@ -1712,7 +1859,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_series(context: &Context, data: PatchSeries) -> FieldResult { + #[graphql(description = "Update an existing series with the specified values")] + fn update_series( + context: &Context, + #[graphql(description = "Values to apply to existing series")] data: PatchSeries, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let series = Series::from_id(&context.db, &data.series_id).unwrap(); context @@ -1730,7 +1881,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_issue(context: &Context, data: PatchIssue) -> FieldResult { + #[graphql(description = "Update an existing issue with the specified values")] + fn update_issue( + context: &Context, + #[graphql(description = "Values to apply to existing issue")] data: PatchIssue, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let issue = Issue::from_id(&context.db, &data.issue_id).unwrap(); context @@ -1750,7 +1905,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_language(context: &Context, data: PatchLanguage) -> FieldResult { + #[graphql(description = "Update an existing language with the specified values")] + fn update_language( + context: &Context, + #[graphql(description = "Values to apply to existing language")] data: PatchLanguage, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let language = Language::from_id(&context.db, &data.language_id).unwrap(); context @@ -1769,7 +1928,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_institution(context: &Context, data: PatchInstitution) -> FieldResult { + #[graphql(description = "Update an existing institution with the specified values")] + fn update_institution( + context: &Context, + #[graphql(description = "Values to apply to existing institution")] data: PatchInstitution, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let account_id = context.token.jwt.as_ref().unwrap().account_id(&context.db); Institution::from_id(&context.db, &data.institution_id) @@ -1778,7 +1941,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_funding(context: &Context, data: PatchFunding) -> FieldResult { + #[graphql(description = "Update an existing funding with the specified values")] + fn update_funding( + context: &Context, + #[graphql(description = "Values to apply to existing funding")] data: PatchFunding, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let funding = Funding::from_id(&context.db, &data.funding_id).unwrap(); context @@ -1797,7 +1964,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_location(context: &Context, data: PatchLocation) -> FieldResult { + #[graphql(description = "Update an existing location with the specified values")] + fn update_location( + context: &Context, + #[graphql(description = "Values to apply to existing location")] data: PatchLocation, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let location = Location::from_id(&context.db, &data.location_id).unwrap(); context @@ -1830,7 +2001,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_price(context: &Context, data: PatchPrice) -> FieldResult { + #[graphql(description = "Update an existing price with the specified values")] + fn update_price( + context: &Context, + #[graphql(description = "Values to apply to existing price")] data: PatchPrice, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let price = Price::from_id(&context.db, &data.price_id).unwrap(); context @@ -1857,7 +2032,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_subject(context: &Context, data: PatchSubject) -> FieldResult { + #[graphql(description = "Update an existing subject with the specified values")] + fn update_subject( + context: &Context, + #[graphql(description = "Values to apply to existing subject")] data: PatchSubject, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let subject = Subject::from_id(&context.db, &data.subject_id).unwrap(); context @@ -1878,7 +2057,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_affiliation(context: &Context, data: PatchAffiliation) -> FieldResult { + #[graphql(description = "Update an existing affiliation with the specified values")] + fn update_affiliation( + context: &Context, + #[graphql(description = "Values to apply to existing affiliation")] data: PatchAffiliation, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let affiliation = Affiliation::from_id(&context.db, &data.affiliation_id).unwrap(); context @@ -1900,8 +2083,10 @@ impl MutationRoot { .map_err(|e| e.into()) } + #[graphql(description = "Update an existing work relation with the specified values")] fn update_work_relation( context: &Context, + #[graphql(description = "Values to apply to existing work relation")] data: PatchWorkRelation, ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; @@ -1936,7 +2121,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn update_reference(context: &Context, data: PatchReference) -> FieldResult { + #[graphql(description = "Update an existing reference with the specified values")] + fn update_reference( + context: &Context, + #[graphql(description = "Values to apply to existing reference")] data: PatchReference, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let reference = Reference::from_id(&context.db, &data.reference_id).unwrap(); context @@ -1955,7 +2144,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn delete_work(context: &Context, work_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single work using its ID")] + fn delete_work( + context: &Context, + #[graphql(description = "Thoth ID of work to be deleted")] work_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let work = Work::from_id(&context.db, &work_id).unwrap(); context @@ -1965,7 +2158,11 @@ impl MutationRoot { work.delete(&context.db).map_err(|e| e.into()) } - fn delete_publisher(context: &Context, publisher_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single publisher using its ID")] + fn delete_publisher( + context: &Context, + #[graphql(description = "Thoth ID of publisher to be deleted")] publisher_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let publisher = Publisher::from_id(&context.db, &publisher_id).unwrap(); context.account_access.can_edit(publisher_id)?; @@ -1973,7 +2170,11 @@ impl MutationRoot { publisher.delete(&context.db).map_err(|e| e.into()) } - fn delete_imprint(context: &Context, imprint_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single imprint using its ID")] + fn delete_imprint( + context: &Context, + #[graphql(description = "Thoth ID of imprint to be deleted")] imprint_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let imprint = Imprint::from_id(&context.db, &imprint_id).unwrap(); context.account_access.can_edit(imprint.publisher_id())?; @@ -1981,7 +2182,11 @@ impl MutationRoot { imprint.delete(&context.db).map_err(|e| e.into()) } - fn delete_contributor(context: &Context, contributor_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single contributor using its ID")] + fn delete_contributor( + context: &Context, + #[graphql(description = "Thoth ID of contributor to be deleted")] contributor_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; Contributor::from_id(&context.db, &contributor_id) .unwrap() @@ -1989,7 +2194,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn delete_contribution(context: &Context, contribution_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single contribution using its ID")] + fn delete_contribution( + context: &Context, + #[graphql(description = "Thoth ID of contribution to be deleted")] contribution_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let contribution = Contribution::from_id(&context.db, &contribution_id).unwrap(); context @@ -1999,7 +2208,11 @@ impl MutationRoot { contribution.delete(&context.db).map_err(|e| e.into()) } - fn delete_publication(context: &Context, publication_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single publication using its ID")] + fn delete_publication( + context: &Context, + #[graphql(description = "Thoth ID of publication to be deleted")] publication_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let publication = Publication::from_id(&context.db, &publication_id).unwrap(); context @@ -2009,7 +2222,11 @@ impl MutationRoot { publication.delete(&context.db).map_err(|e| e.into()) } - fn delete_series(context: &Context, series_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single series using its ID")] + fn delete_series( + context: &Context, + #[graphql(description = "Thoth ID of series to be deleted")] series_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let series = Series::from_id(&context.db, &series_id).unwrap(); context @@ -2019,7 +2236,11 @@ impl MutationRoot { series.delete(&context.db).map_err(|e| e.into()) } - fn delete_issue(context: &Context, issue_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single issue using its ID")] + fn delete_issue( + context: &Context, + #[graphql(description = "Thoth ID of issue to be deleted")] issue_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let issue = Issue::from_id(&context.db, &issue_id).unwrap(); context @@ -2029,7 +2250,11 @@ impl MutationRoot { issue.delete(&context.db).map_err(|e| e.into()) } - fn delete_language(context: &Context, language_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single language using its ID")] + fn delete_language( + context: &Context, + #[graphql(description = "Thoth ID of language to be deleted")] language_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let language = Language::from_id(&context.db, &language_id).unwrap(); context @@ -2039,7 +2264,11 @@ impl MutationRoot { language.delete(&context.db).map_err(|e| e.into()) } - fn delete_institution(context: &Context, institution_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single institution using its ID")] + fn delete_institution( + context: &Context, + #[graphql(description = "Thoth ID of institution to be deleted")] institution_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; Institution::from_id(&context.db, &institution_id) .unwrap() @@ -2047,7 +2276,11 @@ impl MutationRoot { .map_err(|e| e.into()) } - fn delete_funding(context: &Context, funding_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single funding using its ID")] + fn delete_funding( + context: &Context, + #[graphql(description = "Thoth ID of funding to be deleted")] funding_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let funding = Funding::from_id(&context.db, &funding_id).unwrap(); context @@ -2057,7 +2290,11 @@ impl MutationRoot { funding.delete(&context.db).map_err(|e| e.into()) } - fn delete_location(context: &Context, location_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single location using its ID")] + fn delete_location( + context: &Context, + #[graphql(description = "Thoth ID of location to be deleted")] location_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let location = Location::from_id(&context.db, &location_id).unwrap(); context @@ -2067,7 +2304,11 @@ impl MutationRoot { location.delete(&context.db).map_err(|e| e.into()) } - fn delete_price(context: &Context, price_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single price using its ID")] + fn delete_price( + context: &Context, + #[graphql(description = "Thoth ID of price to be deleted")] price_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let price = Price::from_id(&context.db, &price_id).unwrap(); context @@ -2077,7 +2318,11 @@ impl MutationRoot { price.delete(&context.db).map_err(|e| e.into()) } - fn delete_subject(context: &Context, subject_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single subject using its ID")] + fn delete_subject( + context: &Context, + #[graphql(description = "Thoth ID of subject to be deleted")] subject_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let subject = Subject::from_id(&context.db, &subject_id).unwrap(); context @@ -2087,7 +2332,11 @@ impl MutationRoot { subject.delete(&context.db).map_err(|e| e.into()) } - fn delete_affiliation(context: &Context, affiliation_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single affiliation using its ID")] + fn delete_affiliation( + context: &Context, + #[graphql(description = "Thoth ID of affiliation to be deleted")] affiliation_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let affiliation = Affiliation::from_id(&context.db, &affiliation_id).unwrap(); context @@ -2097,9 +2346,10 @@ impl MutationRoot { affiliation.delete(&context.db).map_err(|e| e.into()) } + #[graphql(description = "Delete a single work relation using its ID")] fn delete_work_relation( context: &Context, - work_relation_id: Uuid, + #[graphql(description = "Thoth ID of work relation to be deleted")] work_relation_id: Uuid, ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let work_relation = WorkRelation::from_id(&context.db, &work_relation_id).unwrap(); @@ -2117,7 +2367,11 @@ impl MutationRoot { work_relation.delete(&context.db).map_err(|e| e.into()) } - fn delete_reference(context: &Context, reference_id: Uuid) -> FieldResult { + #[graphql(description = "Delete a single reference using its ID")] + fn delete_reference( + context: &Context, + #[graphql(description = "Thoth ID of reference to be deleted")] reference_id: Uuid, + ) -> FieldResult { context.token.jwt.as_ref().ok_or(ThothError::Unauthorised)?; let reference = Reference::from_id(&context.db, &reference_id).unwrap(); context @@ -2130,14 +2384,17 @@ impl MutationRoot { #[juniper::graphql_object(Context = Context, description = "A written text that can be published")] impl Work { + #[graphql(description = "Thoth ID of the work")] pub fn work_id(&self) -> &Uuid { &self.work_id } + #[graphql(description = "Type of the work")] pub fn work_type(&self) -> &WorkType { &self.work_type } + #[graphql(description = "Publication status of the work")] pub fn work_status(&self) -> &WorkStatus { &self.work_status } @@ -2167,6 +2424,7 @@ impl Work { self.edition.as_ref() } + #[graphql(description = "Thoth ID of the work's imprint")] pub fn imprint_id(&self) -> Uuid { self.imprint_id } @@ -2178,53 +2436,70 @@ impl Work { self.doi.as_ref() } + #[graphql(description = "Date the work was published")] pub fn publication_date(&self) -> Option { self.publication_date } #[graphql( - description = "Date a work was withdrawn from publication. Only applies to out of print and withdrawn from sale works." + description = "Date the work was withdrawn from publication. Only applies to out of print and withdrawn from sale works." )] pub fn withdrawn_date(&self) -> Option { self.withdrawn_date } + #[graphql(description = "Place of publication of the work")] pub fn place(&self) -> Option<&String> { self.place.as_ref() } + #[graphql( + description = "Total number of pages in the work. In most cases, unnumbered pages (e.g. endpapers) should be omitted from this count." + )] pub fn page_count(&self) -> Option<&i32> { self.page_count.as_ref() } + #[graphql( + description = "Breakdown of work's page count into front matter, main content, and/or back matter (e.g. 'xi + 140')" + )] pub fn page_breakdown(&self) -> Option<&String> { self.page_breakdown.as_ref() } + #[graphql(description = "Total number of images in the work")] pub fn image_count(&self) -> Option<&i32> { self.image_count.as_ref() } + #[graphql(description = "Total number of tables in the work")] pub fn table_count(&self) -> Option<&i32> { self.table_count.as_ref() } + #[graphql(description = "Total number of audio fragments in the work")] pub fn audio_count(&self) -> Option<&i32> { self.audio_count.as_ref() } + #[graphql(description = "Total number of video fragments in the work")] pub fn video_count(&self) -> Option<&i32> { self.video_count.as_ref() } + #[graphql( + description = "URL of the license which applies to this work (frequently a Creative Commons license for open-access works)" + )] pub fn license(&self) -> Option<&String> { self.license.as_ref() } + #[graphql(description = "Copyright holder of the work")] pub fn copyright_holder(&self) -> Option<&String> { self.copyright_holder.as_ref() } + #[graphql(description = "URL of the web page of the work")] pub fn landing_page(&self) -> Option<&String> { self.landing_page.as_ref() } @@ -2243,10 +2518,16 @@ impl Work { self.oclc.as_ref() } + #[graphql( + description = "Short abstract of the work. Where a work has two different versions of the abstract, the truncated version should be entered here. Otherwise, it can be left blank. This field is not output in metadata formats; where relevant, Long Abstract is used instead." + )] pub fn short_abstract(&self) -> Option<&String> { self.short_abstract.as_ref() } + #[graphql( + description = "Abstract of the work. Where a work has only one abstract, it should be entered here, and Short Abstract can be left blank. Long Abstract is output in metadata formats, and Short Abstract is not." + )] pub fn long_abstract(&self) -> Option<&String> { self.long_abstract.as_ref() } @@ -2270,10 +2551,12 @@ impl Work { self.toc.as_ref() } + #[graphql(description = "URL of the work's cover image")] pub fn cover_url(&self) -> Option<&String> { self.cover_url.as_ref() } + #[graphql(description = "Caption describing the work's cover image")] pub fn cover_caption(&self) -> Option<&String> { self.cover_caption.as_ref() } @@ -2312,6 +2595,7 @@ impl Work { self.updated_at_with_relations.clone() } + #[graphql(description = "Get this work's imprint")] pub fn imprint(&self, context: &Context) -> FieldResult { Imprint::from_id(&context.db, &self.imprint_id).map_err(|e| e.into()) } @@ -2595,26 +2879,34 @@ impl Work { #[juniper::graphql_object(Context = Context, description = "A manifestation of a written text")] impl Publication { + #[graphql(description = "Thoth ID of the publication")] pub fn publication_id(&self) -> Uuid { self.publication_id } + #[graphql(description = "Format of this publication")] pub fn publication_type(&self) -> &PublicationType { &self.publication_type } + #[graphql(description = "Thoth ID of the work to which this publication belongs")] pub fn work_id(&self) -> Uuid { self.work_id } + #[graphql( + description = "International Standard Book Number of the publication, in ISBN-13 format" + )] pub fn isbn(&self) -> Option<&Isbn> { self.isbn.as_ref() } + #[graphql(description = "Date and time at which the publication record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the publication record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } @@ -2762,6 +3054,7 @@ impl Publication { .map_err(|e| e.into()) } + #[graphql(description = "Get the work to which this publication belongs")] pub fn work(&self, context: &Context) -> FieldResult { Work::from_id(&context.db, &self.work_id).map_err(|e| e.into()) } @@ -2769,26 +3062,32 @@ impl Publication { #[juniper::graphql_object(Context = Context, description = "An organisation that produces and distributes written texts.")] impl Publisher { + #[graphql(description = "Thoth ID of the publisher")] pub fn publisher_id(&self) -> Uuid { self.publisher_id } + #[graphql(description = "Name of the publisher")] pub fn publisher_name(&self) -> &String { &self.publisher_name } + #[graphql(description = "Short name of the publisher, if any (e.g. an abbreviation)")] pub fn publisher_shortname(&self) -> Option<&String> { self.publisher_shortname.as_ref() } + #[graphql(description = "URL of the publisher's website")] pub fn publisher_url(&self) -> Option<&String> { self.publisher_url.as_ref() } + #[graphql(description = "Date and time at which the publisher record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the publisher record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } @@ -2834,14 +3133,17 @@ impl Publisher { #[juniper::graphql_object(Context = Context, description = "The brand under which a publisher issues works.")] impl Imprint { + #[graphql(description = "Thoth ID of the imprint")] pub fn imprint_id(&self) -> Uuid { self.imprint_id } + #[graphql(description = "Thoth ID of the publisher to which this imprint belongs")] pub fn publisher_id(&self) -> Uuid { self.publisher_id } + #[graphql(description = "Name of the imprint")] pub fn imprint_name(&self) -> &String { &self.imprint_name } @@ -2859,14 +3161,17 @@ impl Imprint { self.crossmark_doi.as_ref() } + #[graphql(description = "Date and time at which the imprint record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the imprint record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } + #[graphql(description = "Get the publisher to which this imprint belongs")] pub fn publisher(&self, context: &Context) -> FieldResult { Publisher::from_id(&context.db, &self.publisher_id).map_err(|e| e.into()) } @@ -2929,34 +3234,46 @@ impl Imprint { #[juniper::graphql_object(Context = Context, description = "A person who has been involved in the production of a written text.")] impl Contributor { + #[graphql(description = "Thoth ID of the contributor")] pub fn contributor_id(&self) -> Uuid { self.contributor_id } + #[graphql(description = "Given or first name(s) of the contributor")] pub fn first_name(&self) -> Option<&String> { self.first_name.as_ref() } + #[graphql(description = "Family or surname of the contributor")] pub fn last_name(&self) -> &String { &self.last_name } + #[graphql( + description = "Full, serialized name of the contributor. Serialization is often culturally determined." + )] pub fn full_name(&self) -> &String { &self.full_name } + #[graphql( + description = "ORCID (Open Researcher and Contributor ID) of the contributor as full URL. It must use the HTTPS scheme and the orcid.org domain (e.g. https://orcid.org/0000-0002-1825-0097)" + )] pub fn orcid(&self) -> Option<&Orcid> { self.orcid.as_ref() } + #[graphql(description = "URL of the contributor's website")] pub fn website(&self) -> Option<&String> { self.website.as_ref() } + #[graphql(description = "Date and time at which the contributor record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the contributor record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } @@ -2997,58 +3314,82 @@ impl Contributor { #[juniper::graphql_object(Context = Context, description = "A person's involvement in the production of a written text.")] impl Contribution { + #[graphql(description = "Thoth ID of the contribution")] pub fn contribution_id(&self) -> Uuid { self.contribution_id } + #[graphql(description = "Thoth ID of the contributor who created the contribution")] pub fn contributor_id(&self) -> Uuid { self.contributor_id } + #[graphql(description = "Thoth ID of the work in which the contribution appears")] pub fn work_id(&self) -> Uuid { self.work_id } + #[graphql(description = "Nature of the contribution")] pub fn contribution_type(&self) -> &ContributionType { &self.contribution_type } + #[graphql( + description = "Whether this is a main contribution to the work (e.g. contributor credited on title page)" + )] pub fn main_contribution(&self) -> bool { self.main_contribution } + #[graphql(description = "Biography of the contributor at the time of contribution")] pub fn biography(&self) -> Option<&String> { self.biography.as_ref() } + #[graphql(description = "Date and time at which the contribution record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the contribution record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } + #[graphql( + description = "Given or first name(s) of the contributor, as credited in this contribution" + )] pub fn first_name(&self) -> Option<&String> { self.first_name.as_ref() } + #[graphql( + description = "Family or surname of the contributor, as credited in this contribution" + )] pub fn last_name(&self) -> &String { &self.last_name } + #[graphql( + description = "Full, serialized name of the contributor, as credited in this contribution" + )] pub fn full_name(&self) -> &String { &self.full_name } + #[graphql( + description = "Number representing this contribution's position in an ordered list of contributions within the work" + )] pub fn contribution_ordinal(&self) -> &i32 { &self.contribution_ordinal } + #[graphql(description = "Get the work in which the contribution appears")] pub fn work(&self, context: &Context) -> FieldResult { Work::from_id(&context.db, &self.work_id).map_err(|e| e.into()) } + #[graphql(description = "Get the contributor who created the contribution")] pub fn contributor(&self, context: &Context) -> FieldResult { Contributor::from_id(&context.db, &self.contributor_id).map_err(|e| e.into()) } @@ -3084,22 +3425,31 @@ impl Contribution { #[juniper::graphql_object(Context = Context, description = "A periodical of publications about a particular subject.")] impl Series { + #[graphql(description = "Thoth ID of the series")] pub fn series_id(&self) -> Uuid { self.series_id } + #[graphql(description = "Type of the series")] pub fn series_type(&self) -> &SeriesType { &self.series_type } + #[graphql(description = "Name of the series")] pub fn series_name(&self) -> &String { &self.series_name } + #[graphql( + description = "Print ISSN (International Standard Serial Number) of the series. This represents the print media version." + )] pub fn issn_print(&self) -> Option<&String> { self.issn_print.as_ref() } + #[graphql( + description = "Electronic ISSN (International Standard Serial Number) of the series. This represents the online version." + )] pub fn issn_digital(&self) -> Option<&String> { self.issn_digital.as_ref() } @@ -3109,6 +3459,7 @@ impl Series { self.series_url.as_ref() } + #[graphql(description = "Description of the series")] pub fn series_description(&self) -> Option<&String> { self.series_description.as_ref() } @@ -3118,18 +3469,22 @@ impl Series { self.series_cfp_url.as_ref() } + #[graphql(description = "Thoth ID of the imprint to which this series belongs")] pub fn imprint_id(&self) -> Uuid { self.imprint_id } + #[graphql(description = "Date and time at which the series record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the series record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } + #[graphql(description = "Get the imprint linked to this series")] pub fn imprint(&self, context: &Context) -> FieldResult { Imprint::from_id(&context.db, &self.imprint_id).map_err(|e| e.into()) } @@ -3165,34 +3520,44 @@ impl Series { #[juniper::graphql_object(Context = Context, description = "A work published as a number in a periodical.")] impl Issue { + #[graphql(description = "Thoth ID of the issue")] pub fn issue_id(&self) -> Uuid { self.issue_id } + #[graphql(description = "Thoth ID of the work represented by the issue")] pub fn work_id(&self) -> Uuid { self.work_id } + #[graphql(description = "Thoth ID of the series to which the issue belongs")] pub fn series_id(&self) -> Uuid { self.series_id } + #[graphql( + description = "Number representing this issue's position in an ordered list of issues within the series (does not have to correspond to published issue number)" + )] pub fn issue_ordinal(&self) -> &i32 { &self.issue_ordinal } + #[graphql(description = "Date and time at which the issue record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the issue record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } + #[graphql(description = "Get the series to which the issue belongs")] pub fn series(&self, context: &Context) -> FieldResult { Series::from_id(&context.db, &self.series_id).map_err(|e| e.into()) } + #[graphql(description = "Get the work represented by the issue")] pub fn work(&self, context: &Context) -> FieldResult { Work::from_id(&context.db, &self.work_id).map_err(|e| e.into()) } @@ -3200,34 +3565,44 @@ impl Issue { #[juniper::graphql_object(Context = Context, description = "Description of a work's language.")] impl Language { + #[graphql(description = "Thoth ID of the language")] pub fn language_id(&self) -> Uuid { self.language_id } + #[graphql(description = "Thoth ID of the work which has this language")] pub fn work_id(&self) -> Uuid { self.work_id } + #[graphql(description = "Three-letter ISO 639 code representing the language")] pub fn language_code(&self) -> &LanguageCode { &self.language_code } + #[graphql(description = "Relation between this language and the original language of the text")] pub fn language_relation(&self) -> &LanguageRelation { &self.language_relation } + #[graphql( + description = "Whether this is a main language of the work (e.g. used for large sections of the text rather than just isolated quotations)" + )] pub fn main_language(&self) -> bool { self.main_language } + #[graphql(description = "Date and time at which the language record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the language record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } + #[graphql(description = "Get the work which has this language")] pub fn work(&self, context: &Context) -> FieldResult { Work::from_id(&context.db, &self.work_id).map_err(|e| e.into()) } @@ -3235,38 +3610,49 @@ impl Language { #[juniper::graphql_object(Context = Context, description = "A location, such as a web shop or distribution platform, where a publication can be acquired or viewed.")] impl Location { + #[graphql(description = "Thoth ID of the location")] pub fn location_id(&self) -> Uuid { self.location_id } + #[graphql(description = "Thoth ID of the publication linked to this location")] pub fn publication_id(&self) -> Uuid { self.publication_id } + #[graphql(description = "Public-facing URL via which the publication can be accessed")] pub fn landing_page(&self) -> Option<&String> { self.landing_page.as_ref() } + #[graphql(description = "Direct link to the full text file")] pub fn full_text_url(&self) -> Option<&String> { self.full_text_url.as_ref() } + #[graphql(description = "Platform on which the publication is hosted")] pub fn location_platform(&self) -> &LocationPlatform { &self.location_platform } + #[graphql( + description = "Whether this is the canonical location for this specific publication (e.g. the main platform on which the print version is sold, or the official version of record hosted on the publisher's own web server)" + )] pub fn canonical(&self) -> bool { self.canonical } + #[graphql(description = "Date and time at which the location record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the location record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } + #[graphql(description = "Get the publication linked to this location")] pub fn publication(&self, context: &Context) -> FieldResult { Publication::from_id(&context.db, &self.publication_id).map_err(|e| e.into()) } @@ -3274,30 +3660,39 @@ impl Location { #[juniper::graphql_object(Context = Context, description = "The amount of money, in any currency, that a publication costs.")] impl Price { + #[graphql(description = "Thoth ID of the price")] pub fn price_id(&self) -> Uuid { self.price_id } + #[graphql(description = "Thoth ID of the publication linked to this price")] pub fn publication_id(&self) -> Uuid { self.publication_id } + #[graphql( + description = "Three-letter ISO 4217 code representing the currency used in this price" + )] pub fn currency_code(&self) -> &CurrencyCode { &self.currency_code } + #[graphql(description = "Value of the publication in the selected currency")] pub fn unit_price(&self) -> f64 { self.unit_price } + #[graphql(description = "Date and time at which the price record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the price record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } + #[graphql(description = "Get the publication linked to this price")] pub fn publication(&self, context: &Context) -> FieldResult { Publication::from_id(&context.db, &self.publication_id).map_err(|e| e.into()) } @@ -3305,34 +3700,44 @@ impl Price { #[juniper::graphql_object(Context = Context, description = "A significant discipline or term related to a work.")] impl Subject { + #[graphql(description = "Thoth ID of the subject")] pub fn subject_id(&self) -> &Uuid { &self.subject_id } + #[graphql(description = "Thoth ID of the work to which the subject is related")] pub fn work_id(&self) -> &Uuid { &self.work_id } + #[graphql(description = "Type of the subject (e.g. the subject category scheme being used)")] pub fn subject_type(&self) -> &SubjectType { &self.subject_type } + #[graphql(description = "Code representing the subject within the selected type")] pub fn subject_code(&self) -> &String { &self.subject_code } + #[graphql( + description = "Number representing this subject's position in an ordered list of subjects of the same type within the work" + )] pub fn subject_ordinal(&self) -> &i32 { &self.subject_ordinal } + #[graphql(description = "Date and time at which the subject record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the subject record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } + #[graphql(description = "Get the work to which the subject is related")] pub fn work(&self, context: &Context) -> FieldResult { Work::from_id(&context.db, &self.work_id).map_err(|e| e.into()) } @@ -3340,10 +3745,12 @@ impl Subject { #[juniper::graphql_object(Context = Context, description = "An organisation with which contributors may be affiliated or by which works may be funded.")] impl Institution { + #[graphql(description = "Thoth ID of the institution")] pub fn institution_id(&self) -> &Uuid { &self.institution_id } + #[graphql(description = "Name of the institution")] pub fn institution_name(&self) -> &String { &self.institution_name } @@ -3355,6 +3762,9 @@ impl Institution { self.institution_doi.as_ref() } + #[graphql( + description = "Three-letter ISO 3166-1 code representing the country where this institution is based" + )] pub fn country_code(&self) -> Option<&CountryCode> { self.country_code.as_ref() } @@ -3366,10 +3776,12 @@ impl Institution { self.ror.as_ref() } + #[graphql(description = "Date and time at which the institution record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the institution record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } @@ -3433,50 +3845,62 @@ impl Institution { #[juniper::graphql_object(Context = Context, description = "A grant awarded to the publication of a work by an institution.")] impl Funding { + #[graphql(description = "Thoth ID of the funding")] pub fn funding_id(&self) -> &Uuid { &self.funding_id } + #[graphql(description = "Thoth ID of the funded work")] pub fn work_id(&self) -> &Uuid { &self.work_id } + #[graphql(description = "Thoth ID of the funding institution")] pub fn institution_id(&self) -> &Uuid { &self.institution_id } + #[graphql(description = "Name of the funding program")] pub fn program(&self) -> Option<&String> { self.program.as_ref() } + #[graphql(description = "Name of the funding project")] pub fn project_name(&self) -> Option<&String> { self.project_name.as_ref() } + #[graphql(description = "Short name of the funding project")] pub fn project_shortname(&self) -> Option<&String> { self.project_shortname.as_ref() } + #[graphql(description = "Grant number of the funding project")] pub fn grant_number(&self) -> Option<&String> { self.grant_number.as_ref() } + #[graphql(description = "Jurisdiction of the funding project")] pub fn jurisdiction(&self) -> Option<&String> { self.jurisdiction.as_ref() } + #[graphql(description = "Date and time at which the funding record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the funding record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } + #[graphql(description = "Get the funded work")] pub fn work(&self, context: &Context) -> FieldResult { Work::from_id(&context.db, &self.work_id).map_err(|e| e.into()) } + #[graphql(description = "Get the funding institution")] pub fn institution(&self, context: &Context) -> FieldResult { Institution::from_id(&context.db, &self.institution_id).map_err(|e| e.into()) } @@ -3484,38 +3908,51 @@ impl Funding { #[juniper::graphql_object(Context = Context, description = "An association between a person and an institution for a specific contribution.")] impl Affiliation { + #[graphql(description = "Thoth ID of the affiliation")] pub fn affiliation_id(&self) -> Uuid { self.affiliation_id } + #[graphql(description = "Thoth ID of the contribution linked to this affiliation")] pub fn contribution_id(&self) -> Uuid { self.contribution_id } + #[graphql(description = "Thoth ID of the institution linked to this affiliation")] pub fn institution_id(&self) -> Uuid { self.institution_id } + #[graphql( + description = "Number representing this affiliation's position in an ordered list of affiliations within the contribution" + )] pub fn affiliation_ordinal(&self) -> &i32 { &self.affiliation_ordinal } + #[graphql( + description = "Position of the contributor at the institution at the time of contribution" + )] pub fn position(&self) -> Option<&String> { self.position.as_ref() } + #[graphql(description = "Date and time at which the affiliation record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the affiliation record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } + #[graphql(description = "Get the institution linked to this affiliation")] pub fn institution(&self, context: &Context) -> FieldResult { Institution::from_id(&context.db, &self.institution_id).map_err(|e| e.into()) } + #[graphql(description = "Get the contribution linked to this affiliation")] pub fn contribution(&self, context: &Context) -> FieldResult { Contribution::from_id(&context.db, &self.contribution_id).map_err(|e| e.into()) } @@ -3523,34 +3960,44 @@ impl Affiliation { #[juniper::graphql_object(Context = Context, description = "A relationship between two works, e.g. a book and one of its chapters, or an original and its translation.")] impl WorkRelation { + #[graphql(description = "Thoth ID of the work relation")] pub fn work_relation_id(&self) -> &Uuid { &self.work_relation_id } + #[graphql(description = "Thoth ID of the relator work")] pub fn relator_work_id(&self) -> &Uuid { &self.relator_work_id } + #[graphql(description = "Thoth ID of the related work")] pub fn related_work_id(&self) -> &Uuid { &self.related_work_id } + #[graphql(description = "Nature of the relationship")] pub fn relation_type(&self) -> &RelationType { &self.relation_type } + #[graphql( + description = "Number representing this work relation's position in an ordered list of relations of the same type within the work" + )] pub fn relation_ordinal(&self) -> &i32 { &self.relation_ordinal } + #[graphql(description = "Date and time at which the work relation record was created")] pub fn created_at(&self) -> Timestamp { self.created_at.clone() } + #[graphql(description = "Date and time at which the work relation record was last updated")] pub fn updated_at(&self) -> Timestamp { self.updated_at.clone() } + #[graphql(description = "Get the related work")] pub fn related_work(&self, context: &Context) -> FieldResult { Work::from_id(&context.db, &self.related_work_id).map_err(|e| e.into()) } From 601a5d9d240f32e899043503dfdc14928677016a Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:02:37 +0100 Subject: [PATCH 2/7] Add graphql description tag to every derived GraphQL object in API model modules --- thoth-api/src/model/affiliation/mod.rs | 2 ++ thoth-api/src/model/contribution/mod.rs | 2 ++ thoth-api/src/model/contributor/mod.rs | 2 ++ thoth-api/src/model/funding/mod.rs | 2 ++ thoth-api/src/model/imprint/mod.rs | 2 ++ thoth-api/src/model/institution/mod.rs | 3 +++ thoth-api/src/model/issue/mod.rs | 2 ++ thoth-api/src/model/language/mod.rs | 4 ++++ thoth-api/src/model/location/mod.rs | 3 +++ thoth-api/src/model/price/mod.rs | 3 +++ thoth-api/src/model/publication/mod.rs | 3 +++ thoth-api/src/model/publisher/mod.rs | 2 ++ thoth-api/src/model/reference/mod.rs | 2 ++ thoth-api/src/model/series/mod.rs | 5 ++++- thoth-api/src/model/subject/mod.rs | 3 +++ thoth-api/src/model/work/mod.rs | 4 ++++ thoth-api/src/model/work_relation/mod.rs | 3 +++ 17 files changed, 46 insertions(+), 1 deletion(-) diff --git a/thoth-api/src/model/affiliation/mod.rs b/thoth-api/src/model/affiliation/mod.rs index 4712d1332..d3ad6b392 100644 --- a/thoth-api/src/model/affiliation/mod.rs +++ b/thoth-api/src/model/affiliation/mod.rs @@ -58,6 +58,7 @@ pub struct AffiliationWithContribution { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new association between a person and an institution for a specific contribution"), diesel(table_name = affiliation) )] pub struct NewAffiliation { @@ -70,6 +71,7 @@ pub struct NewAffiliation { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing association between a person and an institution for a specific contribution"), diesel(table_name = affiliation, treat_none_as_null = true) )] pub struct PatchAffiliation { diff --git a/thoth-api/src/model/contribution/mod.rs b/thoth-api/src/model/contribution/mod.rs index aa670d6d0..bf8265d99 100644 --- a/thoth-api/src/model/contribution/mod.rs +++ b/thoth-api/src/model/contribution/mod.rs @@ -153,6 +153,7 @@ pub struct ContributionWithWork { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new individual involvement in the production of a work"), diesel(table_name = contribution) )] pub struct NewContribution { @@ -170,6 +171,7 @@ pub struct NewContribution { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an individual involvement in the production of a work"), diesel(table_name = contribution, treat_none_as_null = true) )] pub struct PatchContribution { diff --git a/thoth-api/src/model/contributor/mod.rs b/thoth-api/src/model/contributor/mod.rs index e9657b6dd..67d97fd21 100644 --- a/thoth-api/src/model/contributor/mod.rs +++ b/thoth-api/src/model/contributor/mod.rs @@ -52,6 +52,7 @@ pub struct Contributor { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new individual involved in the production of works"), diesel(table_name = contributor) )] pub struct NewContributor { @@ -65,6 +66,7 @@ pub struct NewContributor { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing individual involved in the production of works"), diesel(table_name = contributor, treat_none_as_null = true) )] pub struct PatchContributor { diff --git a/thoth-api/src/model/funding/mod.rs b/thoth-api/src/model/funding/mod.rs index f46f8f431..9494664e5 100644 --- a/thoth-api/src/model/funding/mod.rs +++ b/thoth-api/src/model/funding/mod.rs @@ -66,6 +66,7 @@ pub struct FundingWithWork { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new grant awarded to the publication of a work by an institution"), diesel(table_name = funding) )] pub struct NewFunding { @@ -81,6 +82,7 @@ pub struct NewFunding { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing grant awarded to the publication of a work by an institution"), diesel(table_name = funding, treat_none_as_null = true) )] pub struct PatchFunding { diff --git a/thoth-api/src/model/imprint/mod.rs b/thoth-api/src/model/imprint/mod.rs index ceb1ad4db..7333925d4 100644 --- a/thoth-api/src/model/imprint/mod.rs +++ b/thoth-api/src/model/imprint/mod.rs @@ -61,6 +61,7 @@ pub struct ImprintWithPublisher { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new brand under which a publisher issues works"), diesel(table_name = imprint) )] pub struct NewImprint { @@ -73,6 +74,7 @@ pub struct NewImprint { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing brand under which a publisher issues works"), diesel(table_name = imprint, treat_none_as_null = true) )] pub struct PatchImprint { diff --git a/thoth-api/src/model/institution/mod.rs b/thoth-api/src/model/institution/mod.rs index d5c5cdcf3..23b45a7c2 100644 --- a/thoth-api/src/model/institution/mod.rs +++ b/thoth-api/src/model/institution/mod.rs @@ -53,6 +53,7 @@ pub struct Institution { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new organisation with which contributors may be affiliated or by which works may be funded"), diesel(table_name = institution) )] pub struct NewInstitution { @@ -65,6 +66,7 @@ pub struct NewInstitution { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing organisation with which contributors may be affiliated or by which works may be funded"), diesel(table_name = institution, treat_none_as_null = true) )] pub struct PatchInstitution { @@ -78,6 +80,7 @@ pub struct PatchInstitution { #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), + graphql(description = "Three-letter ISO 3166-1 code representing a country"), ExistingTypePath = "crate::schema::sql_types::CountryCode" )] #[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] diff --git a/thoth-api/src/model/issue/mod.rs b/thoth-api/src/model/issue/mod.rs index 4bad542e0..4d933380a 100644 --- a/thoth-api/src/model/issue/mod.rs +++ b/thoth-api/src/model/issue/mod.rs @@ -47,6 +47,7 @@ pub struct IssueWithSeries { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new work published as a number in a periodical"), diesel(table_name = issue) )] pub struct NewIssue { @@ -58,6 +59,7 @@ pub struct NewIssue { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing work published as a number in a periodical"), diesel(table_name = issue, treat_none_as_null = true) )] pub struct PatchIssue { diff --git a/thoth-api/src/model/language/mod.rs b/thoth-api/src/model/language/mod.rs index 7532fa9ef..9c8355b18 100644 --- a/thoth-api/src/model/language/mod.rs +++ b/thoth-api/src/model/language/mod.rs @@ -12,6 +12,7 @@ use crate::schema::language_history; #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), + graphql(description = "Relation between a language and the original language of a text"), ExistingTypePath = "crate::schema::sql_types::LanguageRelation" )] #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] @@ -57,6 +58,7 @@ pub struct Language { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new description of a work's language"), diesel(table_name = language) )] pub struct NewLanguage { @@ -69,6 +71,7 @@ pub struct NewLanguage { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing description of a work's language"), diesel(table_name = language, treat_none_as_null = true) )] pub struct PatchLanguage { @@ -82,6 +85,7 @@ pub struct PatchLanguage { #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), + graphql(description = "Three-letter ISO 639 code representing a language"), ExistingTypePath = "crate::schema::sql_types::LanguageCode" )] #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] diff --git a/thoth-api/src/model/location/mod.rs b/thoth-api/src/model/location/mod.rs index ab352b6c3..b02543e3c 100644 --- a/thoth-api/src/model/location/mod.rs +++ b/thoth-api/src/model/location/mod.rs @@ -13,6 +13,7 @@ use crate::schema::location_history; #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), + graphql(description = "Platform on which a publication is hosted"), ExistingTypePath = "crate::schema::sql_types::LocationPlatform" )] #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] @@ -104,6 +105,7 @@ pub struct Location { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new location (such as a web shop or distribution platform) where a publication can be acquired or viewed"), diesel(table_name = location) )] pub struct NewLocation { @@ -117,6 +119,7 @@ pub struct NewLocation { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing location (such as a web shop or distribution platform) where a publication can be acquired or viewed"), diesel(table_name = location, treat_none_as_null = true) )] pub struct PatchLocation { diff --git a/thoth-api/src/model/price/mod.rs b/thoth-api/src/model/price/mod.rs index 10024dffe..6a4ad883c 100644 --- a/thoth-api/src/model/price/mod.rs +++ b/thoth-api/src/model/price/mod.rs @@ -38,6 +38,7 @@ pub struct Price { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new amount of money that a publication costs"), diesel(table_name = price) )] pub struct NewPrice { @@ -49,6 +50,7 @@ pub struct NewPrice { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing amount of money that a publication costs"), diesel(table_name = price, treat_none_as_null = true) )] pub struct PatchPrice { @@ -61,6 +63,7 @@ pub struct PatchPrice { #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), + graphql(description = "Three-letter ISO 4217 code representing a currency"), ExistingTypePath = "crate::schema::sql_types::CurrencyCode" )] #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] diff --git a/thoth-api/src/model/publication/mod.rs b/thoth-api/src/model/publication/mod.rs index 8865353fb..c2a45cc5f 100644 --- a/thoth-api/src/model/publication/mod.rs +++ b/thoth-api/src/model/publication/mod.rs @@ -18,6 +18,7 @@ use crate::schema::publication_history; #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), + graphql(description = "Format of a publication"), ExistingTypePath = "crate::schema::sql_types::PublicationType" )] #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] @@ -130,6 +131,7 @@ pub struct PublicationWithRelations { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new manifestation of a written text"), diesel(table_name = publication) )] pub struct NewPublication { @@ -149,6 +151,7 @@ pub struct NewPublication { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing manifestation of a written text"), diesel(table_name = publication, treat_none_as_null = true) )] pub struct PatchPublication { diff --git a/thoth-api/src/model/publisher/mod.rs b/thoth-api/src/model/publisher/mod.rs index 9ed913faa..bb98f002d 100644 --- a/thoth-api/src/model/publisher/mod.rs +++ b/thoth-api/src/model/publisher/mod.rs @@ -47,6 +47,7 @@ pub struct Publisher { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new organisation that produces and distributes works"), diesel(table_name = publisher) )] pub struct NewPublisher { @@ -58,6 +59,7 @@ pub struct NewPublisher { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing organisation that produces and distributes works"), diesel(table_name = publisher, treat_none_as_null = true) )] pub struct PatchPublisher { diff --git a/thoth-api/src/model/reference/mod.rs b/thoth-api/src/model/reference/mod.rs index 1eab54e92..f1ba9cb6c 100644 --- a/thoth-api/src/model/reference/mod.rs +++ b/thoth-api/src/model/reference/mod.rs @@ -79,6 +79,7 @@ pub struct Reference { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new citation to a written text"), diesel(table_name = reference) )] pub struct NewReference { @@ -109,6 +110,7 @@ pub struct NewReference { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing citation to a written text"), diesel(table_name = reference, treat_none_as_null = true) )] pub struct PatchReference { diff --git a/thoth-api/src/model/series/mod.rs b/thoth-api/src/model/series/mod.rs index 5edbedb30..27e16ed1a 100644 --- a/thoth-api/src/model/series/mod.rs +++ b/thoth-api/src/model/series/mod.rs @@ -15,6 +15,7 @@ use crate::schema::series_history; #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), + graphql(description = "Type of a series"), ExistingTypePath = "crate::schema::sql_types::SeriesType" )] #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] @@ -89,6 +90,7 @@ pub struct SeriesWithImprint { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new periodical of publications"), diesel(table_name = series) )] pub struct NewSeries { @@ -105,6 +107,7 @@ pub struct NewSeries { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing periodical of publications"), diesel(table_name = series, treat_none_as_null = true) )] pub struct PatchSeries { @@ -138,7 +141,7 @@ pub struct NewSeriesHistory { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject), - graphql(description = "Field and order to use when sorting seriess list") + graphql(description = "Field and order to use when sorting serieses list") )] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)] pub struct SeriesOrderBy { diff --git a/thoth-api/src/model/subject/mod.rs b/thoth-api/src/model/subject/mod.rs index 8ef1f68bd..16571b299 100644 --- a/thoth-api/src/model/subject/mod.rs +++ b/thoth-api/src/model/subject/mod.rs @@ -16,6 +16,7 @@ use thoth_errors::ThothResult; #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), + graphql(description = "Type of a subject (e.g. the subject category scheme being used)"), ExistingTypePath = "crate::schema::sql_types::SubjectType" )] #[derive( @@ -76,6 +77,7 @@ pub struct Subject { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new significant discipline or term related to a work"), diesel(table_name = subject) )] pub struct NewSubject { @@ -88,6 +90,7 @@ pub struct NewSubject { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing significant discipline or term related to a work"), diesel(table_name = subject, treat_none_as_null = true) )] pub struct PatchSubject { diff --git a/thoth-api/src/model/work/mod.rs b/thoth-api/src/model/work/mod.rs index 6046a431d..df442caa3 100644 --- a/thoth-api/src/model/work/mod.rs +++ b/thoth-api/src/model/work/mod.rs @@ -26,6 +26,7 @@ use crate::schema::work_history; #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), + graphql(description = "Type of a work"), ExistingTypePath = "crate::schema::sql_types::WorkType" )] #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] @@ -48,6 +49,7 @@ pub enum WorkType { #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), + graphql(description = "Publication status of a work"), ExistingTypePath = "crate::schema::sql_types::WorkStatus" )] #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] @@ -225,6 +227,7 @@ pub struct WorkWithRelations { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new written text that can be published"), diesel(table_name = work) )] pub struct NewWork { @@ -266,6 +269,7 @@ pub struct NewWork { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing written text that can be published"), diesel(table_name = work, treat_none_as_null = true) )] pub struct PatchWork { diff --git a/thoth-api/src/model/work_relation/mod.rs b/thoth-api/src/model/work_relation/mod.rs index ee9539d3d..5774022af 100644 --- a/thoth-api/src/model/work_relation/mod.rs +++ b/thoth-api/src/model/work_relation/mod.rs @@ -14,6 +14,7 @@ use crate::schema::work_relation_history; #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), + graphql(description = "Nature of a relationship between works"), ExistingTypePath = "crate::schema::sql_types::RelationType" )] #[derive( @@ -85,6 +86,7 @@ pub struct WorkRelationWithRelatedWork { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), + graphql(description = "Set of values required to define a new relationship between two works"), diesel(table_name = work_relation) )] pub struct NewWorkRelation { @@ -97,6 +99,7 @@ pub struct NewWorkRelation { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), + graphql(description = "Set of values required to update an existing relationship between two works"), diesel(table_name = work_relation, treat_none_as_null = true) )] pub struct PatchWorkRelation { From bb4eeeab90e9e6b5923a14723e85898580f0ea52 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:55:23 +0100 Subject: [PATCH 3/7] Add graphql description tags to LanguageCode enum (using ISO 639 tables) --- thoth-api/src/model/language/mod.rs | 547 ++++++++++++++++++++++++++++ 1 file changed, 547 insertions(+) diff --git a/thoth-api/src/model/language/mod.rs b/thoth-api/src/model/language/mod.rs index 9c8355b18..b025316a2 100644 --- a/thoth-api/src/model/language/mod.rs +++ b/thoth-api/src/model/language/mod.rs @@ -92,493 +92,1040 @@ pub struct PatchLanguage { #[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[strum(serialize_all = "UPPERCASE")] pub enum LanguageCode { + #[cfg_attr(feature = "backend", graphql(description = "Afar"))] Aar, + #[cfg_attr(feature = "backend", graphql(description = "Abkhazian"))] Abk, + #[cfg_attr(feature = "backend", graphql(description = "Achinese"))] Ace, + #[cfg_attr(feature = "backend", graphql(description = "Acoli"))] Ach, + #[cfg_attr(feature = "backend", graphql(description = "Adangme"))] Ada, + #[cfg_attr(feature = "backend", graphql(description = "Adyghe"))] Ady, + #[cfg_attr(feature = "backend", graphql(description = "Afro-Asiatic languages"))] Afa, + #[cfg_attr(feature = "backend", graphql(description = "Afrihili"))] Afh, + #[cfg_attr(feature = "backend", graphql(description = "Afrikaans"))] Afr, + #[cfg_attr(feature = "backend", graphql(description = "Ainu (Japan)"))] Ain, + #[cfg_attr(feature = "backend", graphql(description = "Akan"))] Aka, + #[cfg_attr(feature = "backend", graphql(description = "Akkadian"))] Akk, + #[cfg_attr(feature = "backend", graphql(description = "Albanian"))] Alb, + #[cfg_attr(feature = "backend", graphql(description = "Aleut"))] Ale, + #[cfg_attr(feature = "backend", graphql(description = "Algonquian languages"))] Alg, + #[cfg_attr(feature = "backend", graphql(description = "Southern Altai"))] Alt, + #[cfg_attr(feature = "backend", graphql(description = "Amharic"))] Amh, + #[cfg_attr( + feature = "backend", + graphql(description = "Old English (ca. 450-1100)") + )] Ang, + #[cfg_attr(feature = "backend", graphql(description = "Angika"))] Anp, + #[cfg_attr(feature = "backend", graphql(description = "Apache languages"))] Apa, + #[cfg_attr(feature = "backend", graphql(description = "Arabic"))] Ara, + #[cfg_attr( + feature = "backend", + graphql(description = "Official Aramaic (700-300 BCE)") + )] Arc, + #[cfg_attr(feature = "backend", graphql(description = "Aragonese"))] Arg, + #[cfg_attr(feature = "backend", graphql(description = "Armenian"))] Arm, + #[cfg_attr(feature = "backend", graphql(description = "Mapudungun"))] Arn, + #[cfg_attr(feature = "backend", graphql(description = "Arapaho"))] Arp, + #[cfg_attr(feature = "backend", graphql(description = "Artificial languages"))] Art, + #[cfg_attr(feature = "backend", graphql(description = "Arawak"))] Arw, + #[cfg_attr(feature = "backend", graphql(description = "Assamese"))] Asm, + #[cfg_attr(feature = "backend", graphql(description = "Asturian"))] Ast, + #[cfg_attr(feature = "backend", graphql(description = "Athapascan languages"))] Ath, + #[cfg_attr(feature = "backend", graphql(description = "Australian languages"))] Aus, + #[cfg_attr(feature = "backend", graphql(description = "Avaric"))] Ava, + #[cfg_attr(feature = "backend", graphql(description = "Avestan"))] Ave, + #[cfg_attr(feature = "backend", graphql(description = "Awadhi"))] Awa, + #[cfg_attr(feature = "backend", graphql(description = "Aymara"))] Aym, + #[cfg_attr(feature = "backend", graphql(description = "Azerbaijani"))] Aze, + #[cfg_attr(feature = "backend", graphql(description = "Banda languages"))] Bad, + #[cfg_attr(feature = "backend", graphql(description = "Bamileke languages"))] Bai, + #[cfg_attr(feature = "backend", graphql(description = "Bashkir"))] Bak, + #[cfg_attr(feature = "backend", graphql(description = "Baluchi"))] Bal, + #[cfg_attr(feature = "backend", graphql(description = "Bambara"))] Bam, + #[cfg_attr(feature = "backend", graphql(description = "Balinese"))] Ban, + #[cfg_attr(feature = "backend", graphql(description = "Basque"))] Baq, + #[cfg_attr(feature = "backend", graphql(description = "Basa (Cameroon)"))] Bas, + #[cfg_attr(feature = "backend", graphql(description = "Baltic languages"))] Bat, + #[cfg_attr(feature = "backend", graphql(description = "Beja"))] Bej, + #[cfg_attr(feature = "backend", graphql(description = "Belarusian"))] Bel, + #[cfg_attr(feature = "backend", graphql(description = "Bemba (Zambia)"))] Bem, + #[cfg_attr(feature = "backend", graphql(description = "Bengali"))] Ben, + #[cfg_attr(feature = "backend", graphql(description = "Berber languages"))] Ber, + #[cfg_attr(feature = "backend", graphql(description = "Bhojpuri"))] Bho, + #[cfg_attr(feature = "backend", graphql(description = "Bihari languages"))] Bih, + #[cfg_attr(feature = "backend", graphql(description = "Bikol"))] Bik, + #[cfg_attr(feature = "backend", graphql(description = "Bini"))] Bin, + #[cfg_attr(feature = "backend", graphql(description = "Bislama"))] Bis, + #[cfg_attr(feature = "backend", graphql(description = "Siksika"))] Bla, + #[cfg_attr(feature = "backend", graphql(description = "Bantu languages"))] Bnt, + #[cfg_attr(feature = "backend", graphql(description = "Bosnian"))] Bos, + #[cfg_attr(feature = "backend", graphql(description = "Braj"))] Bra, + #[cfg_attr(feature = "backend", graphql(description = "Breton"))] Bre, + #[cfg_attr(feature = "backend", graphql(description = "Batak languages"))] Btk, + #[cfg_attr(feature = "backend", graphql(description = "Buriat"))] Bua, + #[cfg_attr(feature = "backend", graphql(description = "Buginese"))] Bug, + #[cfg_attr(feature = "backend", graphql(description = "Bulgarian"))] Bul, + #[cfg_attr(feature = "backend", graphql(description = "Burmese"))] Bur, + #[cfg_attr(feature = "backend", graphql(description = "Bilin"))] Byn, + #[cfg_attr(feature = "backend", graphql(description = "Caddo"))] Cad, + #[cfg_attr( + feature = "backend", + graphql(description = "Central American Indian languages") + )] Cai, + #[cfg_attr(feature = "backend", graphql(description = "Galibi Carib"))] Car, + #[cfg_attr(feature = "backend", graphql(description = "Catalan"))] Cat, + #[cfg_attr(feature = "backend", graphql(description = "Caucasian languages"))] Cau, + #[cfg_attr(feature = "backend", graphql(description = "Cebuano"))] Ceb, + #[cfg_attr(feature = "backend", graphql(description = "Celtic languages"))] Cel, + #[cfg_attr(feature = "backend", graphql(description = "Chamorro"))] Cha, + #[cfg_attr(feature = "backend", graphql(description = "Chibcha"))] Chb, + #[cfg_attr(feature = "backend", graphql(description = "Chechen"))] Che, + #[cfg_attr(feature = "backend", graphql(description = "Chagatai"))] Chg, + #[cfg_attr(feature = "backend", graphql(description = "Chinese"))] Chi, + #[cfg_attr(feature = "backend", graphql(description = "Chuukese"))] Chk, + #[cfg_attr(feature = "backend", graphql(description = "Mari (Russia)"))] Chm, + #[cfg_attr(feature = "backend", graphql(description = "Chinook jargon"))] Chn, + #[cfg_attr(feature = "backend", graphql(description = "Choctaw"))] Cho, + #[cfg_attr(feature = "backend", graphql(description = "Chipewyan"))] Chp, + #[cfg_attr(feature = "backend", graphql(description = "Cherokee"))] Chr, + #[cfg_attr(feature = "backend", graphql(description = "Church Slavic"))] Chu, + #[cfg_attr(feature = "backend", graphql(description = "Chuvash"))] Chv, + #[cfg_attr(feature = "backend", graphql(description = "Cheyenne"))] Chy, + #[cfg_attr(feature = "backend", graphql(description = "Chamic languages"))] Cmc, + #[cfg_attr(feature = "backend", graphql(description = "Montenegrin"))] Cnr, + #[cfg_attr(feature = "backend", graphql(description = "Coptic"))] Cop, + #[cfg_attr(feature = "backend", graphql(description = "Cornish"))] Cor, + #[cfg_attr(feature = "backend", graphql(description = "Corsican"))] Cos, + #[cfg_attr( + feature = "backend", + graphql(description = "Creoles and pidgins, English‑based") + )] Cpe, + #[cfg_attr( + feature = "backend", + graphql(description = "Creoles and pidgins, French‑based") + )] Cpf, + #[cfg_attr( + feature = "backend", + graphql(description = "Creoles and pidgins, Portuguese-based") + )] Cpp, + #[cfg_attr(feature = "backend", graphql(description = "Cree"))] Cre, + #[cfg_attr(feature = "backend", graphql(description = "Crimean Tatar"))] Crh, + #[cfg_attr(feature = "backend", graphql(description = "Creoles and pidgins"))] Crp, + #[cfg_attr(feature = "backend", graphql(description = "Kashubian"))] Csb, + #[cfg_attr(feature = "backend", graphql(description = "Cushitic languages"))] Cus, + #[cfg_attr(feature = "backend", graphql(description = "Czech"))] Cze, + #[cfg_attr(feature = "backend", graphql(description = "Dakota"))] Dak, + #[cfg_attr(feature = "backend", graphql(description = "Danish"))] Dan, + #[cfg_attr(feature = "backend", graphql(description = "Dargwa"))] Dar, + #[cfg_attr(feature = "backend", graphql(description = "Land Dayak languages"))] Day, + #[cfg_attr(feature = "backend", graphql(description = "Delaware"))] Del, + #[cfg_attr(feature = "backend", graphql(description = "Slave (Athapascan)"))] Den, + #[cfg_attr(feature = "backend", graphql(description = "Tlicho"))] Dgr, + #[cfg_attr(feature = "backend", graphql(description = "Dinka"))] Din, + #[cfg_attr(feature = "backend", graphql(description = "Dhivehi"))] Div, + #[cfg_attr(feature = "backend", graphql(description = "Dogri (macrolanguage)"))] Doi, + #[cfg_attr(feature = "backend", graphql(description = "Dravidian languages"))] Dra, + #[cfg_attr(feature = "backend", graphql(description = "Lower Sorbian"))] Dsb, + #[cfg_attr(feature = "backend", graphql(description = "Duala"))] Dua, + #[cfg_attr( + feature = "backend", + graphql(description = "Middle Dutch (ca. 1050-1350)") + )] Dum, + #[cfg_attr(feature = "backend", graphql(description = "Dutch"))] Dut, + #[cfg_attr(feature = "backend", graphql(description = "Dyula"))] Dyu, + #[cfg_attr(feature = "backend", graphql(description = "Dzongkha"))] Dzo, + #[cfg_attr(feature = "backend", graphql(description = "Efik"))] Efi, + #[cfg_attr(feature = "backend", graphql(description = "Egyptian (Ancient)"))] Egy, + #[cfg_attr(feature = "backend", graphql(description = "Ekajuk"))] Eka, + #[cfg_attr(feature = "backend", graphql(description = "Elamite"))] Elx, #[default] + #[cfg_attr(feature = "backend", graphql(description = "English"))] Eng, + #[cfg_attr( + feature = "backend", + graphql(description = "Middle English (1100-1500)") + )] Enm, + #[cfg_attr(feature = "backend", graphql(description = "Esperanto"))] Epo, + #[cfg_attr(feature = "backend", graphql(description = "Estonian"))] Est, + #[cfg_attr(feature = "backend", graphql(description = "Ewe"))] Ewe, + #[cfg_attr(feature = "backend", graphql(description = "Ewondo"))] Ewo, + #[cfg_attr(feature = "backend", graphql(description = "Fang (Equatorial Guinea)"))] Fan, + #[cfg_attr(feature = "backend", graphql(description = "Faroese"))] Fao, + #[cfg_attr(feature = "backend", graphql(description = "Fanti"))] Fat, + #[cfg_attr(feature = "backend", graphql(description = "Fijian"))] Fij, + #[cfg_attr(feature = "backend", graphql(description = "Filipino"))] Fil, + #[cfg_attr(feature = "backend", graphql(description = "Finnish"))] Fin, + #[cfg_attr(feature = "backend", graphql(description = "Finno-Ugrian languages"))] Fiu, + #[cfg_attr(feature = "backend", graphql(description = "Fon"))] Fon, + #[cfg_attr(feature = "backend", graphql(description = "French"))] Fre, + #[cfg_attr( + feature = "backend", + graphql(description = "Middle French (ca. 1400-1600)") + )] Frm, + #[cfg_attr( + feature = "backend", + graphql(description = "Old French (842-ca. 1400)") + )] Fro, + #[cfg_attr(feature = "backend", graphql(description = "Northern Frisian"))] Frr, + #[cfg_attr(feature = "backend", graphql(description = "Eastern Frisian"))] Frs, + #[cfg_attr(feature = "backend", graphql(description = "Western Frisian"))] Fry, + #[cfg_attr(feature = "backend", graphql(description = "Fulah"))] Ful, + #[cfg_attr(feature = "backend", graphql(description = "Friulian"))] Fur, + #[cfg_attr(feature = "backend", graphql(description = "Ga"))] Gaa, + #[cfg_attr(feature = "backend", graphql(description = "Gayo"))] Gay, + #[cfg_attr( + feature = "backend", + graphql(description = "Gbaya (Central African Republic)") + )] Gba, + #[cfg_attr(feature = "backend", graphql(description = "Germanic languages"))] Gem, + #[cfg_attr(feature = "backend", graphql(description = "Georgian"))] Geo, + #[cfg_attr(feature = "backend", graphql(description = "German"))] Ger, + #[cfg_attr(feature = "backend", graphql(description = "Geez"))] Gez, + #[cfg_attr(feature = "backend", graphql(description = "Gilbertese"))] Gil, + #[cfg_attr(feature = "backend", graphql(description = "Scottish Gaelic"))] Gla, + #[cfg_attr(feature = "backend", graphql(description = "Irish"))] Gle, + #[cfg_attr(feature = "backend", graphql(description = "Galician"))] Glg, + #[cfg_attr(feature = "backend", graphql(description = "Manx"))] Glv, + #[cfg_attr( + feature = "backend", + graphql(description = "Middle High German (ca. 1050-1500)") + )] Gmh, + #[cfg_attr( + feature = "backend", + graphql(description = "Old High German (ca. 750-1050)") + )] Goh, + #[cfg_attr(feature = "backend", graphql(description = "Gondi"))] Gon, + #[cfg_attr(feature = "backend", graphql(description = "Gorontalo"))] Gor, + #[cfg_attr(feature = "backend", graphql(description = "Gothic"))] Got, + #[cfg_attr(feature = "backend", graphql(description = "Grebo"))] Grb, + #[cfg_attr(feature = "backend", graphql(description = "Ancient Greek (to 1453)"))] Grc, + #[cfg_attr(feature = "backend", graphql(description = "Modern Greek (1453-)"))] Gre, + #[cfg_attr(feature = "backend", graphql(description = "Guarani"))] Grn, + #[cfg_attr(feature = "backend", graphql(description = "Swiss German"))] Gsw, + #[cfg_attr(feature = "backend", graphql(description = "Gujarati"))] Guj, + #[cfg_attr(feature = "backend", graphql(description = "Gwichʼin"))] Gwi, + #[cfg_attr(feature = "backend", graphql(description = "Haida"))] Hai, + #[cfg_attr(feature = "backend", graphql(description = "Haitian"))] Hat, + #[cfg_attr(feature = "backend", graphql(description = "Hausa"))] Hau, + #[cfg_attr(feature = "backend", graphql(description = "Hawaiian"))] Haw, + #[cfg_attr(feature = "backend", graphql(description = "Hebrew"))] Heb, + #[cfg_attr(feature = "backend", graphql(description = "Herero"))] Her, + #[cfg_attr(feature = "backend", graphql(description = "Hiligaynon"))] Hil, + #[cfg_attr(feature = "backend", graphql(description = "Himachali languages"))] Him, + #[cfg_attr(feature = "backend", graphql(description = "Hindi"))] Hin, + #[cfg_attr(feature = "backend", graphql(description = "Hittite"))] Hit, + #[cfg_attr(feature = "backend", graphql(description = "Hmong"))] Hmn, + #[cfg_attr(feature = "backend", graphql(description = "Hiri Motu"))] Hmo, + #[cfg_attr(feature = "backend", graphql(description = "Croatian"))] Hrv, + #[cfg_attr(feature = "backend", graphql(description = "Upper Sorbian"))] Hsb, + #[cfg_attr(feature = "backend", graphql(description = "Hungarian"))] Hun, + #[cfg_attr(feature = "backend", graphql(description = "Hupa"))] Hup, + #[cfg_attr(feature = "backend", graphql(description = "Iban"))] Iba, + #[cfg_attr(feature = "backend", graphql(description = "Igbo"))] Ibo, + #[cfg_attr(feature = "backend", graphql(description = "Icelandic"))] Ice, + #[cfg_attr(feature = "backend", graphql(description = "Ido"))] Ido, + #[cfg_attr(feature = "backend", graphql(description = "Sichuan Yi"))] Iii, + #[cfg_attr(feature = "backend", graphql(description = "Ijo languages"))] Ijo, + #[cfg_attr(feature = "backend", graphql(description = "Inuktitut"))] Iku, + #[cfg_attr(feature = "backend", graphql(description = "Interlingue"))] Ile, + #[cfg_attr(feature = "backend", graphql(description = "Iloko"))] Ilo, + #[cfg_attr( + feature = "backend", + graphql(description = "Interlingua (International Auxiliary Language Association)") + )] Ina, + #[cfg_attr(feature = "backend", graphql(description = "Indic languages"))] Inc, + #[cfg_attr(feature = "backend", graphql(description = "Indonesian"))] Ind, + #[cfg_attr(feature = "backend", graphql(description = "Indo-European languages"))] Ine, + #[cfg_attr(feature = "backend", graphql(description = "Ingush"))] Inh, + #[cfg_attr(feature = "backend", graphql(description = "Inupiaq"))] Ipk, + #[cfg_attr(feature = "backend", graphql(description = "Iranian languages"))] Ira, + #[cfg_attr(feature = "backend", graphql(description = "Iroquoian languages"))] Iro, + #[cfg_attr(feature = "backend", graphql(description = "Italian"))] Ita, + #[cfg_attr(feature = "backend", graphql(description = "Javanese"))] Jav, + #[cfg_attr(feature = "backend", graphql(description = "Lojban"))] Jbo, + #[cfg_attr(feature = "backend", graphql(description = "Japanese"))] Jpn, + #[cfg_attr(feature = "backend", graphql(description = "Judeo-Persian"))] Jpr, + #[cfg_attr(feature = "backend", graphql(description = "Judeo-Arabic"))] Jrb, + #[cfg_attr(feature = "backend", graphql(description = "Kara-Kalpak"))] Kaa, + #[cfg_attr(feature = "backend", graphql(description = "Kabyle"))] Kab, + #[cfg_attr(feature = "backend", graphql(description = "Kachin"))] Kac, + #[cfg_attr(feature = "backend", graphql(description = "Kalaallisut"))] Kal, + #[cfg_attr(feature = "backend", graphql(description = "Kamba (Kenya)"))] Kam, + #[cfg_attr(feature = "backend", graphql(description = "Kannada"))] Kan, + #[cfg_attr(feature = "backend", graphql(description = "Karen languages"))] Kar, + #[cfg_attr(feature = "backend", graphql(description = "Kashmiri"))] Kas, + #[cfg_attr(feature = "backend", graphql(description = "Kanuri"))] Kau, + #[cfg_attr(feature = "backend", graphql(description = "Kawi"))] Kaw, + #[cfg_attr(feature = "backend", graphql(description = "Kazakh"))] Kaz, + #[cfg_attr(feature = "backend", graphql(description = "Kabardian"))] Kbd, + #[cfg_attr(feature = "backend", graphql(description = "Khasi"))] Kha, + #[cfg_attr(feature = "backend", graphql(description = "Khoisan languages"))] Khi, + #[cfg_attr(feature = "backend", graphql(description = "Khmer"))] Khm, + #[cfg_attr(feature = "backend", graphql(description = "Khotanese"))] Kho, + #[cfg_attr(feature = "backend", graphql(description = "Kikuyu"))] Kik, + #[cfg_attr(feature = "backend", graphql(description = "Kinyarwanda"))] Kin, + #[cfg_attr(feature = "backend", graphql(description = "Kirghiz"))] Kir, + #[cfg_attr(feature = "backend", graphql(description = "Kimbundu"))] Kmb, + #[cfg_attr(feature = "backend", graphql(description = "Konkani (macrolanguage)"))] Kok, + #[cfg_attr(feature = "backend", graphql(description = "Komi"))] Kom, + #[cfg_attr(feature = "backend", graphql(description = "Kongo"))] Kon, + #[cfg_attr(feature = "backend", graphql(description = "Korean"))] Kor, + #[cfg_attr(feature = "backend", graphql(description = "Kosraean"))] Kos, + #[cfg_attr(feature = "backend", graphql(description = "Kpelle"))] Kpe, + #[cfg_attr(feature = "backend", graphql(description = "Karachay-Balkar"))] Krc, + #[cfg_attr(feature = "backend", graphql(description = "Karelian"))] Krl, + #[cfg_attr(feature = "backend", graphql(description = "Kru languages"))] Kro, + #[cfg_attr(feature = "backend", graphql(description = "Kurukh"))] Kru, + #[cfg_attr(feature = "backend", graphql(description = "Kuanyama"))] Kua, + #[cfg_attr(feature = "backend", graphql(description = "Kumyk"))] Kum, + #[cfg_attr(feature = "backend", graphql(description = "Kurdish"))] Kur, + #[cfg_attr(feature = "backend", graphql(description = "Kutenai"))] Kut, + #[cfg_attr(feature = "backend", graphql(description = "Ladino"))] Lad, + #[cfg_attr(feature = "backend", graphql(description = "Lahnda"))] Lah, + #[cfg_attr(feature = "backend", graphql(description = "Lamba"))] Lam, + #[cfg_attr(feature = "backend", graphql(description = "Lao"))] Lao, + #[cfg_attr(feature = "backend", graphql(description = "Latin"))] Lat, + #[cfg_attr(feature = "backend", graphql(description = "Latvian"))] Lav, + #[cfg_attr(feature = "backend", graphql(description = "Lezghian"))] Lez, + #[cfg_attr(feature = "backend", graphql(description = "Limburgan"))] Lim, + #[cfg_attr(feature = "backend", graphql(description = "Lingala"))] Lin, + #[cfg_attr(feature = "backend", graphql(description = "Lithuanian"))] Lit, + #[cfg_attr(feature = "backend", graphql(description = "Mongo"))] Lol, + #[cfg_attr(feature = "backend", graphql(description = "Lozi"))] Loz, + #[cfg_attr(feature = "backend", graphql(description = "Luxembourgish"))] Ltz, + #[cfg_attr(feature = "backend", graphql(description = "Luba-Lulua"))] Lua, + #[cfg_attr(feature = "backend", graphql(description = "Luba-Katanga"))] Lub, + #[cfg_attr(feature = "backend", graphql(description = "Ganda"))] Lug, + #[cfg_attr(feature = "backend", graphql(description = "Luiseno"))] Lui, + #[cfg_attr(feature = "backend", graphql(description = "Lunda"))] Lun, + #[cfg_attr(feature = "backend", graphql(description = "Luo (Kenya and Tanzania)"))] Luo, + #[cfg_attr(feature = "backend", graphql(description = "Lushai"))] Lus, + #[cfg_attr(feature = "backend", graphql(description = "Macedonian"))] Mac, + #[cfg_attr(feature = "backend", graphql(description = "Madurese"))] Mad, + #[cfg_attr(feature = "backend", graphql(description = "Magahi"))] Mag, + #[cfg_attr(feature = "backend", graphql(description = "Marshallese"))] Mah, + #[cfg_attr(feature = "backend", graphql(description = "Maithili"))] Mai, + #[cfg_attr(feature = "backend", graphql(description = "Makasar"))] Mak, + #[cfg_attr(feature = "backend", graphql(description = "Malayalam"))] Mal, + #[cfg_attr(feature = "backend", graphql(description = "Mandingo"))] Man, + #[cfg_attr(feature = "backend", graphql(description = "Maori"))] Mao, + #[cfg_attr(feature = "backend", graphql(description = "Austronesian languages"))] Map, + #[cfg_attr(feature = "backend", graphql(description = "Marathi"))] Mar, + #[cfg_attr(feature = "backend", graphql(description = "Masai"))] Mas, + #[cfg_attr(feature = "backend", graphql(description = "Malay (macrolanguage)"))] May, + #[cfg_attr(feature = "backend", graphql(description = "Moksha"))] Mdf, + #[cfg_attr(feature = "backend", graphql(description = "Mandar"))] Mdr, + #[cfg_attr(feature = "backend", graphql(description = "Mende (Sierra Leone)"))] Men, + #[cfg_attr(feature = "backend", graphql(description = "Middle Irish (900-1200)"))] Mga, + #[cfg_attr(feature = "backend", graphql(description = "Mi'kmaq"))] Mic, + #[cfg_attr(feature = "backend", graphql(description = "Minangkabau"))] Min, + #[cfg_attr(feature = "backend", graphql(description = "Uncoded languages"))] Mis, + #[cfg_attr(feature = "backend", graphql(description = "Mon-Khmer languages"))] Mkh, + #[cfg_attr(feature = "backend", graphql(description = "Malagasy"))] Mlg, + #[cfg_attr(feature = "backend", graphql(description = "Maltese"))] Mlt, + #[cfg_attr(feature = "backend", graphql(description = "Manchu"))] Mnc, + #[cfg_attr(feature = "backend", graphql(description = "Manipuri"))] Mni, + #[cfg_attr(feature = "backend", graphql(description = "Manobo languages"))] Mno, + #[cfg_attr(feature = "backend", graphql(description = "Mohawk"))] Moh, + #[cfg_attr(feature = "backend", graphql(description = "Mongolian"))] Mon, + #[cfg_attr(feature = "backend", graphql(description = "Mossi"))] Mos, + #[cfg_attr(feature = "backend", graphql(description = "Multiple languages"))] Mul, + #[cfg_attr(feature = "backend", graphql(description = "Munda languages"))] Mun, + #[cfg_attr(feature = "backend", graphql(description = "Creek"))] Mus, + #[cfg_attr(feature = "backend", graphql(description = "Mirandese"))] Mwl, + #[cfg_attr(feature = "backend", graphql(description = "Marwari"))] Mwr, + #[cfg_attr(feature = "backend", graphql(description = "Mayan languages"))] Myn, + #[cfg_attr(feature = "backend", graphql(description = "Erzya"))] Myv, + #[cfg_attr(feature = "backend", graphql(description = "Nahuatl languages"))] Nah, + #[cfg_attr( + feature = "backend", + graphql(description = "North American Indian languages") + )] Nai, + #[cfg_attr(feature = "backend", graphql(description = "Neapolitan"))] Nap, + #[cfg_attr(feature = "backend", graphql(description = "Nauru"))] Nau, + #[cfg_attr(feature = "backend", graphql(description = "Navajo"))] Nav, + #[cfg_attr(feature = "backend", graphql(description = "South Ndebele"))] Nbl, + #[cfg_attr(feature = "backend", graphql(description = "North Ndebele"))] Nde, + #[cfg_attr(feature = "backend", graphql(description = "Ndonga"))] Ndo, + #[cfg_attr(feature = "backend", graphql(description = "Low German"))] Nds, + #[cfg_attr(feature = "backend", graphql(description = "Nepali (macrolanguage)"))] Nep, + #[cfg_attr(feature = "backend", graphql(description = "Newari"))] New, + #[cfg_attr(feature = "backend", graphql(description = "Nias"))] Nia, + #[cfg_attr( + feature = "backend", + graphql(description = "Niger-Kordofanian languages") + )] Nic, + #[cfg_attr(feature = "backend", graphql(description = "Niuean"))] Niu, + #[cfg_attr(feature = "backend", graphql(description = "Norwegian Nynorsk"))] Nno, + #[cfg_attr(feature = "backend", graphql(description = "Norwegian Bokmål"))] Nob, + #[cfg_attr(feature = "backend", graphql(description = "Nogai"))] Nog, + #[cfg_attr(feature = "backend", graphql(description = "Old Norse"))] Non, + #[cfg_attr(feature = "backend", graphql(description = "Norwegian"))] Nor, + #[cfg_attr(feature = "backend", graphql(description = "N'Ko"))] Nqo, + #[cfg_attr(feature = "backend", graphql(description = "Pedi"))] Nso, + #[cfg_attr(feature = "backend", graphql(description = "Nubian languages"))] Nub, + #[cfg_attr(feature = "backend", graphql(description = "Classical Newari"))] Nwc, + #[cfg_attr(feature = "backend", graphql(description = "Nyanja"))] Nya, + #[cfg_attr(feature = "backend", graphql(description = "Nyamwezi"))] Nym, + #[cfg_attr(feature = "backend", graphql(description = "Nyankole"))] Nyn, + #[cfg_attr(feature = "backend", graphql(description = "Nyoro"))] Nyo, + #[cfg_attr(feature = "backend", graphql(description = "Nzima"))] Nzi, + #[cfg_attr(feature = "backend", graphql(description = "Occitan (post 1500)"))] Oci, + #[cfg_attr(feature = "backend", graphql(description = "Ojibwa"))] Oji, + #[cfg_attr(feature = "backend", graphql(description = "Oriya (macrolanguage)"))] Ori, + #[cfg_attr(feature = "backend", graphql(description = "Oromo"))] Orm, + #[cfg_attr(feature = "backend", graphql(description = "Osage"))] Osa, + #[cfg_attr(feature = "backend", graphql(description = "Ossetian"))] Oss, + #[cfg_attr( + feature = "backend", + graphql(description = "Ottoman Turkish (1500-1928)") + )] Ota, + #[cfg_attr(feature = "backend", graphql(description = "Otomian languages"))] Oto, + #[cfg_attr(feature = "backend", graphql(description = "Papuan languages"))] Paa, + #[cfg_attr(feature = "backend", graphql(description = "Pangasinan"))] Pag, + #[cfg_attr(feature = "backend", graphql(description = "Pahlavi"))] Pal, + #[cfg_attr(feature = "backend", graphql(description = "Pampanga"))] Pam, + #[cfg_attr(feature = "backend", graphql(description = "Panjabi"))] Pan, + #[cfg_attr(feature = "backend", graphql(description = "Papiamento"))] Pap, + #[cfg_attr(feature = "backend", graphql(description = "Palauan"))] Pau, + #[cfg_attr( + feature = "backend", + graphql(description = "Old Persian (ca. 600-400 B.C.)") + )] Peo, + #[cfg_attr(feature = "backend", graphql(description = "Persian"))] Per, + #[cfg_attr(feature = "backend", graphql(description = "Philippine languages"))] Phi, + #[cfg_attr(feature = "backend", graphql(description = "Phoenician"))] Phn, + #[cfg_attr(feature = "backend", graphql(description = "Pali"))] Pli, + #[cfg_attr(feature = "backend", graphql(description = "Polish"))] Pol, + #[cfg_attr(feature = "backend", graphql(description = "Pohnpeian"))] Pon, + #[cfg_attr(feature = "backend", graphql(description = "Portuguese"))] Por, + #[cfg_attr(feature = "backend", graphql(description = "Prakrit languages"))] Pra, + #[cfg_attr(feature = "backend", graphql(description = "Old Provençal (to 1500)"))] Pro, + #[cfg_attr(feature = "backend", graphql(description = "Pushto"))] Pus, + #[cfg_attr(feature = "backend", graphql(description = "Reserved for local use"))] Qaa, + #[cfg_attr(feature = "backend", graphql(description = "Quechua"))] Que, + #[cfg_attr(feature = "backend", graphql(description = "Rajasthani"))] Raj, + #[cfg_attr(feature = "backend", graphql(description = "Rapanui"))] Rap, + #[cfg_attr(feature = "backend", graphql(description = "Rarotongan"))] Rar, + #[cfg_attr(feature = "backend", graphql(description = "Romance languages"))] Roa, + #[cfg_attr(feature = "backend", graphql(description = "Romansh"))] Roh, + #[cfg_attr(feature = "backend", graphql(description = "Romany"))] Rom, + #[cfg_attr(feature = "backend", graphql(description = "Romanian"))] Rum, + #[cfg_attr(feature = "backend", graphql(description = "Rundi"))] Run, + #[cfg_attr(feature = "backend", graphql(description = "Macedo-Romanian"))] Rup, + #[cfg_attr(feature = "backend", graphql(description = "Russian"))] Rus, + #[cfg_attr(feature = "backend", graphql(description = "Sandawe"))] Sad, + #[cfg_attr(feature = "backend", graphql(description = "Sango"))] Sag, + #[cfg_attr(feature = "backend", graphql(description = "Yakut"))] Sah, + #[cfg_attr( + feature = "backend", + graphql(description = "South American Indian languages") + )] Sai, + #[cfg_attr(feature = "backend", graphql(description = "Salishan languages"))] Sal, + #[cfg_attr(feature = "backend", graphql(description = "Samaritan Aramaic"))] Sam, + #[cfg_attr(feature = "backend", graphql(description = "Sanskrit"))] San, + #[cfg_attr(feature = "backend", graphql(description = "Sasak"))] Sas, + #[cfg_attr(feature = "backend", graphql(description = "Santali"))] Sat, + #[cfg_attr(feature = "backend", graphql(description = "Sicilian"))] Scn, + #[cfg_attr(feature = "backend", graphql(description = "Scots"))] Sco, + #[cfg_attr(feature = "backend", graphql(description = "Selkup"))] Sel, + #[cfg_attr(feature = "backend", graphql(description = "Semitic languages"))] Sem, + #[cfg_attr(feature = "backend", graphql(description = "Old Irish (to 900)"))] Sga, + #[cfg_attr(feature = "backend", graphql(description = "sign languages"))] Sgn, + #[cfg_attr(feature = "backend", graphql(description = "Shan"))] Shn, + #[cfg_attr(feature = "backend", graphql(description = "Sidamo"))] Sid, + #[cfg_attr(feature = "backend", graphql(description = "Sinhala"))] Sin, + #[cfg_attr(feature = "backend", graphql(description = "Siouan languages"))] Sio, + #[cfg_attr(feature = "backend", graphql(description = "Sino-Tibetan languages"))] Sit, + #[cfg_attr(feature = "backend", graphql(description = "Slavic languages"))] Sla, + #[cfg_attr(feature = "backend", graphql(description = "Slovak"))] Slo, + #[cfg_attr(feature = "backend", graphql(description = "Slovenian"))] Slv, + #[cfg_attr(feature = "backend", graphql(description = "Southern Sami"))] Sma, + #[cfg_attr(feature = "backend", graphql(description = "Northern Sami"))] Sme, + #[cfg_attr(feature = "backend", graphql(description = "Sami languages"))] Smi, + #[cfg_attr(feature = "backend", graphql(description = "Lule Sami"))] Smj, + #[cfg_attr(feature = "backend", graphql(description = "Inari Sami"))] Smn, + #[cfg_attr(feature = "backend", graphql(description = "Samoan"))] Smo, + #[cfg_attr(feature = "backend", graphql(description = "Skolt Sami"))] Sms, + #[cfg_attr(feature = "backend", graphql(description = "Shona"))] Sna, + #[cfg_attr(feature = "backend", graphql(description = "Sindhi"))] Snd, + #[cfg_attr(feature = "backend", graphql(description = "Soninke"))] Snk, + #[cfg_attr(feature = "backend", graphql(description = "Sogdian"))] Sog, + #[cfg_attr(feature = "backend", graphql(description = "Somali"))] Som, + #[cfg_attr(feature = "backend", graphql(description = "Songhai languages"))] Son, + #[cfg_attr(feature = "backend", graphql(description = "Southern Sotho"))] Sot, + #[cfg_attr(feature = "backend", graphql(description = "Spanish"))] Spa, + #[cfg_attr(feature = "backend", graphql(description = "Sardinian"))] Srd, + #[cfg_attr(feature = "backend", graphql(description = "Sranan Tongo"))] Srn, + #[cfg_attr(feature = "backend", graphql(description = "Serbian"))] Srp, + #[cfg_attr(feature = "backend", graphql(description = "Serer"))] Srr, + #[cfg_attr(feature = "backend", graphql(description = "Nilo-Saharan languages"))] Ssa, + #[cfg_attr(feature = "backend", graphql(description = "Swati"))] Ssw, + #[cfg_attr(feature = "backend", graphql(description = "Sukuma"))] Suk, + #[cfg_attr(feature = "backend", graphql(description = "Sundanese"))] Sun, + #[cfg_attr(feature = "backend", graphql(description = "Susu"))] Sus, + #[cfg_attr(feature = "backend", graphql(description = "Sumerian"))] Sux, + #[cfg_attr(feature = "backend", graphql(description = "Swahili (macrolanguage)"))] Swa, + #[cfg_attr(feature = "backend", graphql(description = "Swedish"))] Swe, + #[cfg_attr(feature = "backend", graphql(description = "Classical Syriac"))] Syc, + #[cfg_attr(feature = "backend", graphql(description = "Syriac"))] Syr, + #[cfg_attr(feature = "backend", graphql(description = "Tahitian"))] Tah, + #[cfg_attr(feature = "backend", graphql(description = "Tai languages"))] Tai, + #[cfg_attr(feature = "backend", graphql(description = "Tamil"))] Tam, + #[cfg_attr(feature = "backend", graphql(description = "Tatar"))] Tat, + #[cfg_attr(feature = "backend", graphql(description = "Telugu"))] Tel, + #[cfg_attr(feature = "backend", graphql(description = "Timne"))] Tem, + #[cfg_attr(feature = "backend", graphql(description = "Tereno"))] Ter, + #[cfg_attr(feature = "backend", graphql(description = "Tetum"))] Tet, + #[cfg_attr(feature = "backend", graphql(description = "Tajik"))] Tgk, + #[cfg_attr(feature = "backend", graphql(description = "Tagalog"))] Tgl, + #[cfg_attr(feature = "backend", graphql(description = "Thai"))] Tha, + #[cfg_attr(feature = "backend", graphql(description = "Tibetan"))] Tib, + #[cfg_attr(feature = "backend", graphql(description = "Tigre"))] Tig, + #[cfg_attr(feature = "backend", graphql(description = "Tigrinya"))] Tir, + #[cfg_attr(feature = "backend", graphql(description = "Tiv"))] Tiv, + #[cfg_attr(feature = "backend", graphql(description = "Tokelau"))] Tkl, + #[cfg_attr(feature = "backend", graphql(description = "Klingon"))] Tlh, + #[cfg_attr(feature = "backend", graphql(description = "Tlingit"))] Tli, + #[cfg_attr(feature = "backend", graphql(description = "Tamashek"))] Tmh, + #[cfg_attr(feature = "backend", graphql(description = "Tonga (Nyasa)"))] Tog, + #[cfg_attr(feature = "backend", graphql(description = "Tonga (Tonga Islands)"))] Ton, + #[cfg_attr(feature = "backend", graphql(description = "Tok Pisin"))] Tpi, + #[cfg_attr(feature = "backend", graphql(description = "Tsimshian"))] Tsi, + #[cfg_attr(feature = "backend", graphql(description = "Tswana"))] Tsn, + #[cfg_attr(feature = "backend", graphql(description = "Tsonga"))] Tso, + #[cfg_attr(feature = "backend", graphql(description = "Turkmen"))] Tuk, + #[cfg_attr(feature = "backend", graphql(description = "Tumbuka"))] Tum, + #[cfg_attr(feature = "backend", graphql(description = "Tupi languages"))] Tup, + #[cfg_attr(feature = "backend", graphql(description = "Turkish"))] Tur, + #[cfg_attr(feature = "backend", graphql(description = "Altaic languages"))] Tut, + #[cfg_attr(feature = "backend", graphql(description = "Tuvalu"))] Tvl, + #[cfg_attr(feature = "backend", graphql(description = "Twi"))] Twi, + #[cfg_attr(feature = "backend", graphql(description = "Tuvinian"))] Tyv, + #[cfg_attr(feature = "backend", graphql(description = "Udmurt"))] Udm, + #[cfg_attr(feature = "backend", graphql(description = "Ugaritic"))] Uga, + #[cfg_attr(feature = "backend", graphql(description = "Uighur"))] Uig, + #[cfg_attr(feature = "backend", graphql(description = "Ukrainian"))] Ukr, + #[cfg_attr(feature = "backend", graphql(description = "Umbundu"))] Umb, + #[cfg_attr(feature = "backend", graphql(description = "Undetermined"))] Und, + #[cfg_attr(feature = "backend", graphql(description = "Urdu"))] Urd, + #[cfg_attr(feature = "backend", graphql(description = "Uzbek"))] Uzb, + #[cfg_attr(feature = "backend", graphql(description = "Vai"))] Vai, + #[cfg_attr(feature = "backend", graphql(description = "Venda"))] Ven, + #[cfg_attr(feature = "backend", graphql(description = "Vietnamese"))] Vie, + #[cfg_attr(feature = "backend", graphql(description = "Volapük"))] Vol, + #[cfg_attr(feature = "backend", graphql(description = "Votic"))] Vot, + #[cfg_attr(feature = "backend", graphql(description = "Wakashan languages"))] Wak, + #[cfg_attr(feature = "backend", graphql(description = "Wolaytta"))] Wal, + #[cfg_attr(feature = "backend", graphql(description = "Waray (Philippines)"))] War, + #[cfg_attr(feature = "backend", graphql(description = "Washo"))] Was, + #[cfg_attr(feature = "backend", graphql(description = "Welsh"))] Wel, + #[cfg_attr(feature = "backend", graphql(description = "Sorbian languages"))] Wen, + #[cfg_attr(feature = "backend", graphql(description = "Walloon"))] Wln, + #[cfg_attr(feature = "backend", graphql(description = "Wolof"))] Wol, + #[cfg_attr(feature = "backend", graphql(description = "Kalmyk"))] Xal, + #[cfg_attr(feature = "backend", graphql(description = "Xhosa"))] Xho, + #[cfg_attr(feature = "backend", graphql(description = "Yao"))] Yao, + #[cfg_attr(feature = "backend", graphql(description = "Yapese"))] Yap, + #[cfg_attr(feature = "backend", graphql(description = "Yiddish"))] Yid, + #[cfg_attr(feature = "backend", graphql(description = "Yoruba"))] Yor, + #[cfg_attr(feature = "backend", graphql(description = "Yupik languages"))] Ypk, + #[cfg_attr(feature = "backend", graphql(description = "Zapotec"))] Zap, + #[cfg_attr(feature = "backend", graphql(description = "Blissymbols"))] Zbl, + #[cfg_attr(feature = "backend", graphql(description = "Zenaga"))] Zen, + #[cfg_attr( + feature = "backend", + graphql(description = "Standard Moroccan Tamazight") + )] Zgh, + #[cfg_attr(feature = "backend", graphql(description = "Zhuang"))] Zha, + #[cfg_attr(feature = "backend", graphql(description = "Zande languages"))] Znd, + #[cfg_attr(feature = "backend", graphql(description = "Zulu"))] Zul, + #[cfg_attr(feature = "backend", graphql(description = "Zuni"))] Zun, + #[cfg_attr(feature = "backend", graphql(description = "No linguistic content"))] Zxx, + #[cfg_attr(feature = "backend", graphql(description = "Zaza"))] Zza, } From 3f57c2199a9ebff82a533ceeb1f73aebaa54b8be Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:08:25 +0100 Subject: [PATCH 4/7] Add graphql description tags to CurrencyCode enum (using ISO 4217 tables) --- thoth-api/src/model/price/mod.rs | 446 +++++++++++++++++++++++++++++++ 1 file changed, 446 insertions(+) diff --git a/thoth-api/src/model/price/mod.rs b/thoth-api/src/model/price/mod.rs index 6a4ad883c..9c1522872 100644 --- a/thoth-api/src/model/price/mod.rs +++ b/thoth-api/src/model/price/mod.rs @@ -70,308 +70,754 @@ pub struct PatchPrice { #[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[strum(serialize_all = "UPPERCASE")] pub enum CurrencyCode { + #[cfg_attr(feature = "backend", graphql(description = "Andorran peseta"))] Adp, + #[cfg_attr( + feature = "backend", + graphql(description = "United Arab Emirates dirham") + )] Aed, + #[cfg_attr(feature = "backend", graphql(description = "Afghan afghani (first)"))] Afa, + #[cfg_attr(feature = "backend", graphql(description = "Afghan afghani"))] Afn, + #[cfg_attr(feature = "backend", graphql(description = "Old Albanian lek"))] Alk, + #[cfg_attr(feature = "backend", graphql(description = "Albanian lek"))] All, + #[cfg_attr(feature = "backend", graphql(description = "Armenian dram"))] Amd, + #[cfg_attr( + feature = "backend", + graphql(description = "Netherlands Antillean guilder") + )] Ang, + #[cfg_attr(feature = "backend", graphql(description = "Angolan kwanza"))] Aoa, + #[cfg_attr(feature = "backend", graphql(description = "Angolan kwanza (first)"))] Aok, + #[cfg_attr(feature = "backend", graphql(description = "Angolan novo kwanza"))] Aon, + #[cfg_attr( + feature = "backend", + graphql(description = "Angolan kwanza reajustado") + )] Aor, + #[cfg_attr(feature = "backend", graphql(description = "Argentine austral"))] Ara, + #[cfg_attr(feature = "backend", graphql(description = "Argentine peso argentino"))] Arp, + #[cfg_attr(feature = "backend", graphql(description = "Argentine peso"))] Ars, + #[cfg_attr(feature = "backend", graphql(description = "Argentine peso ley"))] Ary, + #[cfg_attr(feature = "backend", graphql(description = "Austrian schilling"))] Ats, + #[cfg_attr(feature = "backend", graphql(description = "Australian dollar"))] Aud, + #[cfg_attr(feature = "backend", graphql(description = "Aruban florin"))] Awg, + #[cfg_attr( + feature = "backend", + graphql(description = "Azerbaijani manat (first)") + )] Aym, + #[cfg_attr( + feature = "backend", + graphql(description = "Azerbaijani manat (second)") + )] Azm, + #[cfg_attr(feature = "backend", graphql(description = "Azerbaijani manat"))] Azn, + #[cfg_attr( + feature = "backend", + graphql(description = "Bosnia and Herzegovina dinar") + )] Bad, + #[cfg_attr( + feature = "backend", + graphql(description = "Bosnia and Herzegovina convertible mark") + )] Bam, + #[cfg_attr(feature = "backend", graphql(description = "Barbados dollar"))] Bbd, + #[cfg_attr(feature = "backend", graphql(description = "Bangladeshi taka"))] Bdt, + #[cfg_attr( + feature = "backend", + graphql(description = "Belgian convertible franc") + )] Bec, + #[cfg_attr(feature = "backend", graphql(description = "Belgian franc"))] Bef, + #[cfg_attr(feature = "backend", graphql(description = "Belgian financial franc"))] Bel, + #[cfg_attr(feature = "backend", graphql(description = "Bulgarian lev (first)"))] Bgj, + #[cfg_attr(feature = "backend", graphql(description = "Bulgarian lev (second)"))] Bgk, + #[cfg_attr(feature = "backend", graphql(description = "Bulgarian lev (third)"))] Bgl, + #[cfg_attr(feature = "backend", graphql(description = "Bulgarian lev"))] Bgn, + #[cfg_attr(feature = "backend", graphql(description = "Bahraini dinar"))] Bhd, + #[cfg_attr(feature = "backend", graphql(description = "Burundian franc"))] Bif, + #[cfg_attr(feature = "backend", graphql(description = "Bermudian dollar"))] Bmd, + #[cfg_attr(feature = "backend", graphql(description = "Brunei dollar"))] Bnd, + #[cfg_attr(feature = "backend", graphql(description = "Boliviano"))] Bob, + #[cfg_attr(feature = "backend", graphql(description = "Bolivian peso"))] Bop, + #[cfg_attr(feature = "backend", graphql(description = "Bolivian Mvdol"))] Bov, + #[cfg_attr( + feature = "backend", + graphql(description = "Brazilian cruzeiro (1967-1986)") + )] Brb, + #[cfg_attr(feature = "backend", graphql(description = "Brazilian cruzado"))] Brc, + #[cfg_attr( + feature = "backend", + graphql(description = "Brazilian cruzeiro (1990–1993)") + )] Bre, + #[cfg_attr(feature = "backend", graphql(description = "Brazilian real"))] Brl, + #[cfg_attr(feature = "backend", graphql(description = "Brazilian cruzado novo"))] Brn, + #[cfg_attr(feature = "backend", graphql(description = "Brazilian cruzeiro real"))] Brr, + #[cfg_attr(feature = "backend", graphql(description = "Bahamian dollar"))] Bsd, + #[cfg_attr(feature = "backend", graphql(description = "Bhutanese ngultrum"))] Btn, + #[cfg_attr(feature = "backend", graphql(description = "Burmese kyat"))] Buk, + #[cfg_attr(feature = "backend", graphql(description = "Botswana pula"))] Bwp, + #[cfg_attr(feature = "backend", graphql(description = "Belarusian ruble (first)"))] Byb, + #[cfg_attr(feature = "backend", graphql(description = "Belarusian ruble"))] Byn, + #[cfg_attr( + feature = "backend", + graphql(description = "Belarusian ruble (second)") + )] Byr, + #[cfg_attr(feature = "backend", graphql(description = "Belize dollar"))] Bzd, + #[cfg_attr(feature = "backend", graphql(description = "Canadian dollar"))] Cad, + #[cfg_attr(feature = "backend", graphql(description = "Congolese franc"))] Cdf, + #[cfg_attr( + feature = "backend", + graphql(description = "WIR franc (for electronic currency)") + )] Chc, + #[cfg_attr(feature = "backend", graphql(description = "WIR euro"))] Che, + #[cfg_attr(feature = "backend", graphql(description = "Swiss franc"))] Chf, + #[cfg_attr(feature = "backend", graphql(description = "WIR franc"))] Chw, + #[cfg_attr(feature = "backend", graphql(description = "Unidad de Fomento"))] Clf, + #[cfg_attr(feature = "backend", graphql(description = "Chilean peso"))] Clp, + #[cfg_attr(feature = "backend", graphql(description = "Renminbi"))] Cny, + #[cfg_attr(feature = "backend", graphql(description = "Colombian peso"))] Cop, + #[cfg_attr( + feature = "backend", + graphql(description = "Unidad de Valor Real (UVR)") + )] Cou, + #[cfg_attr(feature = "backend", graphql(description = "Costa Rican colon"))] Crc, + #[cfg_attr(feature = "backend", graphql(description = "Serbian dinar"))] Csd, + #[cfg_attr( + feature = "backend", + graphql(description = "Czechoslovak koruna (second)") + )] Csj, + #[cfg_attr(feature = "backend", graphql(description = "Czechoslovak koruna"))] Csk, + #[cfg_attr(feature = "backend", graphql(description = "Cuban convertible peso"))] Cuc, + #[cfg_attr(feature = "backend", graphql(description = "Cuban peso"))] Cup, + #[cfg_attr(feature = "backend", graphql(description = "Cape Verdean escudo"))] Cve, + #[cfg_attr(feature = "backend", graphql(description = "Cypriot pound"))] Cyp, + #[cfg_attr(feature = "backend", graphql(description = "Czech koruna"))] Czk, + #[cfg_attr(feature = "backend", graphql(description = "East German mark"))] Ddm, + #[cfg_attr(feature = "backend", graphql(description = "German mark"))] Dem, + #[cfg_attr(feature = "backend", graphql(description = "Djiboutian franc"))] Djf, + #[cfg_attr(feature = "backend", graphql(description = "Danish krone"))] Dkk, + #[cfg_attr(feature = "backend", graphql(description = "Dominican peso"))] Dop, + #[cfg_attr(feature = "backend", graphql(description = "Algerian dinar"))] Dzd, + #[cfg_attr(feature = "backend", graphql(description = "Ecuadorian sucre"))] Ecs, + #[cfg_attr( + feature = "backend", + graphql(description = "Ecuador Unidad de Valor Constante") + )] Ecv, + #[cfg_attr(feature = "backend", graphql(description = "Estonian kroon"))] Eek, + #[cfg_attr(feature = "backend", graphql(description = "Egyptian pound"))] Egp, + #[cfg_attr(feature = "backend", graphql(description = "Eritrean nakfa"))] Ern, + #[cfg_attr( + feature = "backend", + graphql(description = "Spanish peseta (account A)") + )] Esa, + #[cfg_attr( + feature = "backend", + graphql(description = "Spanish peseta (account B)") + )] Esb, + #[cfg_attr(feature = "backend", graphql(description = "Spanish peseta"))] Esp, + #[cfg_attr(feature = "backend", graphql(description = "Ethiopian birr"))] Etb, + #[cfg_attr(feature = "backend", graphql(description = "Euro"))] Eur, + #[cfg_attr(feature = "backend", graphql(description = "Finnish markka"))] Fim, + #[cfg_attr(feature = "backend", graphql(description = "Fiji dollar"))] Fjd, + #[cfg_attr(feature = "backend", graphql(description = "Falkland Islands pound"))] Fkp, + #[cfg_attr(feature = "backend", graphql(description = "French franc"))] Frf, #[default] + #[cfg_attr(feature = "backend", graphql(description = "Pound sterling"))] Gbp, + #[cfg_attr(feature = "backend", graphql(description = "Georgian kuponi"))] Gek, + #[cfg_attr(feature = "backend", graphql(description = "Georgian lari"))] Gel, + #[cfg_attr(feature = "backend", graphql(description = "Ghanaian cedi (second)"))] Ghc, + #[cfg_attr(feature = "backend", graphql(description = "Ghanaian cedi (first)"))] Ghp, + #[cfg_attr(feature = "backend", graphql(description = "Ghanaian cedi"))] Ghs, + #[cfg_attr(feature = "backend", graphql(description = "Gibraltar pound"))] Gip, + #[cfg_attr(feature = "backend", graphql(description = "Gambian dalasi"))] Gmd, + #[cfg_attr(feature = "backend", graphql(description = "Guinean syli (first)"))] Gne, + #[cfg_attr(feature = "backend", graphql(description = "Guinean franc"))] Gnf, + #[cfg_attr(feature = "backend", graphql(description = "Guinean syli (second)"))] Gns, + #[cfg_attr( + feature = "backend", + graphql(description = "Equatorial Guinean ekwele") + )] Gqe, + #[cfg_attr(feature = "backend", graphql(description = "Greek drachma"))] Grd, + #[cfg_attr(feature = "backend", graphql(description = "Guatemalan quetzal"))] Gtq, + #[cfg_attr(feature = "backend", graphql(description = "Guinean escudo"))] Gwe, + #[cfg_attr(feature = "backend", graphql(description = "Guinea-Bissau peso"))] Gwp, + #[cfg_attr(feature = "backend", graphql(description = "Guyanese dollar"))] Gyd, + #[cfg_attr(feature = "backend", graphql(description = "Hong Kong dollar"))] Hkd, + #[cfg_attr(feature = "backend", graphql(description = "Honduran lempira"))] Hnl, + #[cfg_attr(feature = "backend", graphql(description = "Croatian dinar"))] Hrd, + #[cfg_attr(feature = "backend", graphql(description = "Croatian kuna"))] Hrk, + #[cfg_attr(feature = "backend", graphql(description = "Haitian gourde"))] Htg, + #[cfg_attr(feature = "backend", graphql(description = "Hungarian forint"))] Huf, + #[cfg_attr(feature = "backend", graphql(description = "Indonesian rupiah"))] Idr, + #[cfg_attr(feature = "backend", graphql(description = "Irish pound"))] Iep, + #[cfg_attr(feature = "backend", graphql(description = "Israeli pound"))] Ilp, + #[cfg_attr(feature = "backend", graphql(description = "Israeli shekel"))] Ilr, + #[cfg_attr(feature = "backend", graphql(description = "Israeli new shekel"))] Ils, + #[cfg_attr(feature = "backend", graphql(description = "Indian rupee"))] Inr, + #[cfg_attr(feature = "backend", graphql(description = "Iraqi dinar"))] Iqd, + #[cfg_attr(feature = "backend", graphql(description = "Iranian rial"))] Irr, + #[cfg_attr(feature = "backend", graphql(description = "Icelandic króna (first)"))] Isj, + #[cfg_attr(feature = "backend", graphql(description = "Icelandic króna"))] Isk, + #[cfg_attr(feature = "backend", graphql(description = "Italian lira"))] Itl, + #[cfg_attr(feature = "backend", graphql(description = "Jamaican dollar"))] Jmd, + #[cfg_attr(feature = "backend", graphql(description = "Jordanian dinar"))] Jod, + #[cfg_attr(feature = "backend", graphql(description = "Japanese yen"))] Jpy, + #[cfg_attr(feature = "backend", graphql(description = "Kenyan shilling"))] Kes, + #[cfg_attr(feature = "backend", graphql(description = "Kyrgyzstani som"))] Kgs, + #[cfg_attr(feature = "backend", graphql(description = "Cambodian riel"))] Khr, + #[cfg_attr(feature = "backend", graphql(description = "Comoro franc"))] Kmf, + #[cfg_attr(feature = "backend", graphql(description = "North Korean won"))] Kpw, + #[cfg_attr(feature = "backend", graphql(description = "South Korean won"))] Krw, + #[cfg_attr(feature = "backend", graphql(description = "Kuwaiti dinar"))] Kwd, + #[cfg_attr(feature = "backend", graphql(description = "Cayman Islands dollar"))] Kyd, + #[cfg_attr(feature = "backend", graphql(description = "Kazakhstani tenge"))] Kzt, + #[cfg_attr(feature = "backend", graphql(description = "Pathet Lao kip"))] Laj, + #[cfg_attr(feature = "backend", graphql(description = "Lao kip"))] Lak, + #[cfg_attr(feature = "backend", graphql(description = "Lebanese pound"))] Lbp, + #[cfg_attr(feature = "backend", graphql(description = "Sri Lankan rupee"))] Lkr, + #[cfg_attr(feature = "backend", graphql(description = "Liberian dollar"))] Lrd, + #[cfg_attr(feature = "backend", graphql(description = "Lesotho loti"))] Lsl, + #[cfg_attr( + feature = "backend", + graphql(description = "Lesotho loti (historic code)") + )] Lsm, + #[cfg_attr(feature = "backend", graphql(description = "Lithuanian litas"))] Ltl, + #[cfg_attr(feature = "backend", graphql(description = "Lithuanian talonas"))] Ltt, + #[cfg_attr( + feature = "backend", + graphql(description = "Luxembourg convertible franc") + )] Luc, + #[cfg_attr(feature = "backend", graphql(description = "Luxembourg franc"))] Luf, + #[cfg_attr( + feature = "backend", + graphql(description = "Luxembourg financial franc") + )] Lul, + #[cfg_attr(feature = "backend", graphql(description = "Latvian lats"))] Lvl, + #[cfg_attr(feature = "backend", graphql(description = "Latvian rublis"))] Lvr, + #[cfg_attr(feature = "backend", graphql(description = "Libyan dinar"))] Lyd, + #[cfg_attr(feature = "backend", graphql(description = "Moroccan dirham"))] Mad, + #[cfg_attr(feature = "backend", graphql(description = "Moldovan leu"))] Mdl, + #[cfg_attr(feature = "backend", graphql(description = "Malagasy ariary"))] Mga, + #[cfg_attr(feature = "backend", graphql(description = "Malagasy franc"))] Mgf, + #[cfg_attr(feature = "backend", graphql(description = "Macedonian denar"))] Mkd, + #[cfg_attr(feature = "backend", graphql(description = "Malian franc"))] Mlf, + #[cfg_attr(feature = "backend", graphql(description = "Myanmar kyat"))] Mmk, + #[cfg_attr(feature = "backend", graphql(description = "Mongolian tögrög"))] Mnt, + #[cfg_attr(feature = "backend", graphql(description = "Macanese pataca"))] Mop, + #[cfg_attr( + feature = "backend", + graphql(description = "Mauritanian ouguiya (first)") + )] Mro, + #[cfg_attr(feature = "backend", graphql(description = "Mauritanian ouguiya"))] Mru, + #[cfg_attr(feature = "backend", graphql(description = "Maltese lira"))] Mtl, + #[cfg_attr(feature = "backend", graphql(description = "Maltese pound"))] Mtp, + #[cfg_attr(feature = "backend", graphql(description = "Mauritian rupee"))] Mur, + #[cfg_attr(feature = "backend", graphql(description = "Maldivian rupee"))] Mvq, + #[cfg_attr(feature = "backend", graphql(description = "Maldivian rufiyaa"))] Mvr, + #[cfg_attr(feature = "backend", graphql(description = "Malawian kwacha"))] Mwk, + #[cfg_attr(feature = "backend", graphql(description = "Mexican peso"))] Mxn, + #[cfg_attr(feature = "backend", graphql(description = "Mexican peso (first)"))] Mxp, + #[cfg_attr( + feature = "backend", + graphql(description = "Mexican Unidad de Inversion (UDI)") + )] Mxv, + #[cfg_attr(feature = "backend", graphql(description = "Malaysian ringgit"))] Myr, + #[cfg_attr(feature = "backend", graphql(description = "Mozambican escudo"))] Mze, + #[cfg_attr( + feature = "backend", + graphql(description = "Mozambican metical (first)") + )] Mzm, + #[cfg_attr(feature = "backend", graphql(description = "Mozambican metical"))] Mzn, + #[cfg_attr(feature = "backend", graphql(description = "Namibian dollar"))] Nad, + #[cfg_attr(feature = "backend", graphql(description = "Nigerian naira"))] Ngn, + #[cfg_attr( + feature = "backend", + graphql(description = "Nicaraguan córdoba (second)") + )] Nic, + #[cfg_attr(feature = "backend", graphql(description = "Nicaraguan córdoba"))] Nio, + #[cfg_attr(feature = "backend", graphql(description = "Dutch guilder"))] Nlg, + #[cfg_attr(feature = "backend", graphql(description = "Norwegian krone"))] Nok, + #[cfg_attr(feature = "backend", graphql(description = "Nepalese rupee"))] Npr, + #[cfg_attr(feature = "backend", graphql(description = "New Zealand dollar"))] Nzd, + #[cfg_attr(feature = "backend", graphql(description = "Omani rial"))] Omr, + #[cfg_attr(feature = "backend", graphql(description = "Panamanian balboa"))] Pab, + #[cfg_attr(feature = "backend", graphql(description = "Peruvian old sol"))] Peh, + #[cfg_attr(feature = "backend", graphql(description = "Peruvian inti"))] Pei, + #[cfg_attr(feature = "backend", graphql(description = "Peruvian sol"))] Pen, + #[cfg_attr( + feature = "backend", + graphql(description = "Peruvian sol (historic code)") + )] Pes, + #[cfg_attr(feature = "backend", graphql(description = "Papua New Guinean kina"))] Pgk, + #[cfg_attr(feature = "backend", graphql(description = "Philippine peso"))] Php, + #[cfg_attr(feature = "backend", graphql(description = "Pakistani rupee"))] Pkr, + #[cfg_attr(feature = "backend", graphql(description = "Polish złoty"))] Pln, + #[cfg_attr(feature = "backend", graphql(description = "Polish złoty (third)"))] Plz, + #[cfg_attr(feature = "backend", graphql(description = "Portuguese escudo"))] Pte, + #[cfg_attr(feature = "backend", graphql(description = "Paraguayan guaraní"))] Pyg, + #[cfg_attr(feature = "backend", graphql(description = "Qatari riyal"))] Qar, + #[cfg_attr( + feature = "backend", + graphql(description = "Rhodesian dollar (historic code)") + )] Rhd, + #[cfg_attr(feature = "backend", graphql(description = "Romanian leu (second)"))] Rok, + #[cfg_attr(feature = "backend", graphql(description = "Romanian leu (third)"))] Rol, + #[cfg_attr(feature = "backend", graphql(description = "Romanian leu"))] Ron, + #[cfg_attr(feature = "backend", graphql(description = "Serbian dinar"))] Rsd, + #[cfg_attr(feature = "backend", graphql(description = "Russian ruble"))] Rub, + #[cfg_attr(feature = "backend", graphql(description = "Russian ruble (old)"))] Rur, + #[cfg_attr(feature = "backend", graphql(description = "Rwandan franc"))] Rwf, + #[cfg_attr(feature = "backend", graphql(description = "Saudi riyal"))] Sar, + #[cfg_attr(feature = "backend", graphql(description = "Solomon Islands dollar"))] Sbd, + #[cfg_attr(feature = "backend", graphql(description = "Seychelles rupee"))] Scr, + #[cfg_attr(feature = "backend", graphql(description = "Sudanese dinar"))] Sdd, + #[cfg_attr(feature = "backend", graphql(description = "Sudanese pound"))] Sdg, + #[cfg_attr(feature = "backend", graphql(description = "Sudanese old pound"))] Sdp, + #[cfg_attr(feature = "backend", graphql(description = "Swedish krona"))] Sek, + #[cfg_attr(feature = "backend", graphql(description = "Singapore dollar"))] Sgd, + #[cfg_attr(feature = "backend", graphql(description = "Saint Helena pound"))] Shp, + #[cfg_attr(feature = "backend", graphql(description = "Slovenian tolar"))] Sit, + #[cfg_attr(feature = "backend", graphql(description = "Slovak koruna"))] Skk, + #[cfg_attr( + feature = "backend", + graphql(description = "Sierra Leonean leone (old leone)") + )] Sll, + #[cfg_attr(feature = "backend", graphql(description = "Somalian shilling"))] Sos, + #[cfg_attr(feature = "backend", graphql(description = "Surinamese dollar"))] Srd, + #[cfg_attr(feature = "backend", graphql(description = "Surinamese guilder"))] Srg, + #[cfg_attr(feature = "backend", graphql(description = "South Sudanese pound"))] Ssp, + #[cfg_attr( + feature = "backend", + graphql(description = "São Tomé and Príncipe dobra (first)") + )] Std, + #[cfg_attr( + feature = "backend", + graphql(description = "São Tomé and Príncipe dobra") + )] Stn, + #[cfg_attr(feature = "backend", graphql(description = "Soviet Union ruble"))] Sur, + #[cfg_attr(feature = "backend", graphql(description = "Salvadoran colón"))] Svc, + #[cfg_attr(feature = "backend", graphql(description = "Syrian pound"))] Syp, + #[cfg_attr(feature = "backend", graphql(description = "Swazi lilangeni"))] Szl, + #[cfg_attr(feature = "backend", graphql(description = "Thai baht"))] Thb, + #[cfg_attr(feature = "backend", graphql(description = "Tajikistani ruble"))] Tjr, + #[cfg_attr(feature = "backend", graphql(description = "Tajikistani somoni"))] Tjs, + #[cfg_attr( + feature = "backend", + graphql(description = "Turkmenistani manat (first)") + )] Tmm, + #[cfg_attr(feature = "backend", graphql(description = "Turkmenistani manat"))] Tmt, + #[cfg_attr(feature = "backend", graphql(description = "Tunisian dinar"))] Tnd, + #[cfg_attr(feature = "backend", graphql(description = "Tongan paʻanga"))] Top, + #[cfg_attr( + feature = "backend", + graphql(description = "Portuguese Timorese escudo") + )] Tpe, + #[cfg_attr(feature = "backend", graphql(description = "Turkish lira (first)"))] Trl, + #[cfg_attr(feature = "backend", graphql(description = "Turkish lira"))] Try, + #[cfg_attr( + feature = "backend", + graphql(description = "Trinidad and Tobago dollar") + )] Ttd, + #[cfg_attr(feature = "backend", graphql(description = "New Taiwan dollar"))] Twd, + #[cfg_attr(feature = "backend", graphql(description = "Tanzanian shilling"))] Tzs, + #[cfg_attr(feature = "backend", graphql(description = "Ukrainian hryvnia"))] Uah, + #[cfg_attr(feature = "backend", graphql(description = "Ukrainian karbovanets"))] Uak, + #[cfg_attr(feature = "backend", graphql(description = "Ugandan shilling"))] Ugs, + #[cfg_attr(feature = "backend", graphql(description = "Old Shilling"))] Ugw, + #[cfg_attr(feature = "backend", graphql(description = "Ugandan shilling"))] Ugx, + #[cfg_attr(feature = "backend", graphql(description = "United States dollar"))] Usd, + #[cfg_attr( + feature = "backend", + graphql(description = "United States dollar (next day)") + )] Usn, + #[cfg_attr( + feature = "backend", + graphql(description = "United States dollar (same day)") + )] Uss, + #[cfg_attr( + feature = "backend", + graphql(description = "Uruguay Peso en Unidades Indexadas (URUIURUI)") + )] Uyi, + #[cfg_attr( + feature = "backend", + graphql(description = "Uruguayan peso (gold standard)") + )] Uyn, + #[cfg_attr(feature = "backend", graphql(description = "Uruguayan nuevo peso"))] Uyp, + #[cfg_attr(feature = "backend", graphql(description = "Uruguayan peso"))] Uyu, + #[cfg_attr(feature = "backend", graphql(description = "Unidad previsional"))] Uyw, + #[cfg_attr(feature = "backend", graphql(description = "Uzbekistani sum"))] Uzs, + #[cfg_attr(feature = "backend", graphql(description = "Venezuelan bolívar"))] Veb, + #[cfg_attr( + feature = "backend", + graphql(description = "Venezuelan bolívar fuerte") + )] Vef, + #[cfg_attr( + feature = "backend", + graphql(description = "Venezuelan sovereign bolívar") + )] Ves, + #[cfg_attr(feature = "backend", graphql(description = "Old Vietnamese dong"))] Vnc, + #[cfg_attr(feature = "backend", graphql(description = "Vietnamese đồng"))] Vnd, + #[cfg_attr(feature = "backend", graphql(description = "Vanuatu vatu"))] Vuv, + #[cfg_attr(feature = "backend", graphql(description = "Samoan tala"))] Wst, + #[cfg_attr(feature = "backend", graphql(description = "CFA franc BEAC"))] Xaf, + #[cfg_attr(feature = "backend", graphql(description = "Silver"))] Xag, + #[cfg_attr(feature = "backend", graphql(description = "Gold"))] Xau, + #[cfg_attr(feature = "backend", graphql(description = "European Composite Unit"))] Xba, + #[cfg_attr(feature = "backend", graphql(description = "European Monetary Unit"))] Xbb, + #[cfg_attr( + feature = "backend", + graphql(description = "European Unit of Account 9") + )] Xbc, + #[cfg_attr( + feature = "backend", + graphql(description = "European Unit of Account 17") + )] Xbd, + #[cfg_attr(feature = "backend", graphql(description = "East Caribbean dollar"))] Xcd, + #[cfg_attr(feature = "backend", graphql(description = "Special drawing rights"))] Xdr, + #[cfg_attr(feature = "backend", graphql(description = "European Currency Unit"))] Xeu, + #[cfg_attr(feature = "backend", graphql(description = "Gold franc"))] Xfo, + #[cfg_attr(feature = "backend", graphql(description = "UIC franc"))] Xfu, + #[cfg_attr(feature = "backend", graphql(description = "CFA franc BCEAO"))] Xof, + #[cfg_attr(feature = "backend", graphql(description = "Palladium"))] Xpd, + #[cfg_attr( + feature = "backend", + graphql(description = "CFP franc (franc Pacifique)") + )] Xpf, + #[cfg_attr(feature = "backend", graphql(description = "Platinum"))] Xpt, + #[cfg_attr(feature = "backend", graphql(description = "RINET funds code"))] Xre, + #[cfg_attr(feature = "backend", graphql(description = "SUCRE"))] Xsu, + #[cfg_attr( + feature = "backend", + graphql(description = "Code reserved for testing") + )] Xts, + #[cfg_attr(feature = "backend", graphql(description = "ADB Unit of Account"))] Xua, + #[cfg_attr(feature = "backend", graphql(description = "No currency"))] Xxx, + #[cfg_attr(feature = "backend", graphql(description = "South Yemeni dinar"))] Ydd, + #[cfg_attr(feature = "backend", graphql(description = "Yemeni rial"))] Yer, + #[cfg_attr(feature = "backend", graphql(description = "Yugoslav dinar (hard)"))] Yud, + #[cfg_attr(feature = "backend", graphql(description = "Yugoslav dinar (Novi)"))] Yum, + #[cfg_attr( + feature = "backend", + graphql(description = "Yugoslav dinar (convertible)") + )] Yun, + #[cfg_attr( + feature = "backend", + graphql(description = "South African financial rand") + )] Zal, + #[cfg_attr(feature = "backend", graphql(description = "South African rand"))] Zar, + #[cfg_attr(feature = "backend", graphql(description = "Zambian kwacha"))] Zmk, + #[cfg_attr(feature = "backend", graphql(description = "Zambian new kwacha"))] Zmw, + #[cfg_attr(feature = "backend", graphql(description = "Zairean new zaire"))] Zrn, + #[cfg_attr(feature = "backend", graphql(description = "Zairean zaire"))] Zrz, + #[cfg_attr(feature = "backend", graphql(description = "Rhodesian dollar"))] Zwc, + #[cfg_attr( + feature = "backend", + graphql(description = "Zimbabwean dollar (first)") + )] Zwd, + #[cfg_attr(feature = "backend", graphql(description = "Zimbabwean dollar"))] Zwl, + #[cfg_attr( + feature = "backend", + graphql(description = "Zimbabwean dollar (second)") + )] Zwn, + #[cfg_attr( + feature = "backend", + graphql(description = "Zimbabwean dollar (third)") + )] Zwr, } From 5fce714eef88db444e1aaf2155eb64f9343fe74d Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:44:57 +0100 Subject: [PATCH 5/7] Add graphql description tags for remaining database enums, e.g. Type options --- thoth-api/src/graphql/utils.rs | 10 + thoth-api/src/model/institution/mod.rs | 279 +++++++++++++++++++++++ thoth-api/src/model/language/mod.rs | 20 +- thoth-api/src/model/location/mod.rs | 106 +++++++-- thoth-api/src/model/mod.rs | 5 + thoth-api/src/model/publication/mod.rs | 72 +++++- thoth-api/src/model/series/mod.rs | 12 +- thoth-api/src/model/work/mod.rs | 34 ++- thoth-api/src/model/work_relation/mod.rs | 62 ++++- 9 files changed, 556 insertions(+), 44 deletions(-) diff --git a/thoth-api/src/graphql/utils.rs b/thoth-api/src/graphql/utils.rs index 260617550..f6c227691 100644 --- a/thoth-api/src/graphql/utils.rs +++ b/thoth-api/src/graphql/utils.rs @@ -5,8 +5,10 @@ use serde::Serialize; #[graphql(description = "Order in which to sort query results (ascending or descending)")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum Direction { + #[cfg_attr(feature = "backend", graphql(description = "Ascending order"))] #[default] Asc, + #[cfg_attr(feature = "backend", graphql(description = "Descending order"))] Desc, } @@ -22,8 +24,16 @@ fn test_direction_default() { )] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum Expression { + #[cfg_attr( + feature = "backend", + graphql(description = "Return only values which are greater than the one supplied") + )] #[default] GreaterThan, + #[cfg_attr( + feature = "backend", + graphql(description = "Return only values which are less than the one supplied") + )] LessThan, } diff --git a/thoth-api/src/model/institution/mod.rs b/thoth-api/src/model/institution/mod.rs index 23b45a7c2..c4c78c963 100644 --- a/thoth-api/src/model/institution/mod.rs +++ b/thoth-api/src/model/institution/mod.rs @@ -86,502 +86,781 @@ pub struct PatchInstitution { #[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum CountryCode { + #[cfg_attr(feature = "backend", graphql(description = "Afghanistan"))] #[strum(serialize = "Afghanistan")] Afg, + #[cfg_attr(feature = "backend", graphql(description = "Åland Islands"))] #[strum(serialize = "Åland Islands")] Ala, + #[cfg_attr(feature = "backend", graphql(description = "Albania"))] #[strum(serialize = "Albania")] Alb, + #[cfg_attr(feature = "backend", graphql(description = "Algeria"))] #[strum(serialize = "Algeria")] Dza, + #[cfg_attr(feature = "backend", graphql(description = "American Samoa"))] #[strum(serialize = "American Samoa")] Asm, + #[cfg_attr(feature = "backend", graphql(description = "Andorra"))] #[strum(serialize = "Andorra")] And, + #[cfg_attr(feature = "backend", graphql(description = "Angola"))] #[strum(serialize = "Angola")] Ago, + #[cfg_attr(feature = "backend", graphql(description = "Anguilla"))] #[strum(serialize = "Anguilla")] Aia, + #[cfg_attr(feature = "backend", graphql(description = "Antarctica"))] #[strum(serialize = "Antarctica")] Ata, + #[cfg_attr(feature = "backend", graphql(description = "Antigua and Barbuda"))] #[strum(serialize = "Antigua and Barbuda")] Atg, + #[cfg_attr(feature = "backend", graphql(description = "Argentina"))] #[strum(serialize = "Argentina")] Arg, + #[cfg_attr(feature = "backend", graphql(description = "Armenia"))] #[strum(serialize = "Armenia")] Arm, + #[cfg_attr(feature = "backend", graphql(description = "Aruba"))] #[strum(serialize = "Aruba")] Abw, + #[cfg_attr(feature = "backend", graphql(description = "Australia"))] #[strum(serialize = "Australia")] Aus, + #[cfg_attr(feature = "backend", graphql(description = "Austria"))] #[strum(serialize = "Austria")] Aut, + #[cfg_attr(feature = "backend", graphql(description = "Azerbaijan"))] #[strum(serialize = "Azerbaijan")] Aze, + #[cfg_attr(feature = "backend", graphql(description = "Bahamas"))] #[strum(serialize = "Bahamas")] Bhs, + #[cfg_attr(feature = "backend", graphql(description = "Bahrain"))] #[strum(serialize = "Bahrain")] Bhr, + #[cfg_attr(feature = "backend", graphql(description = "Bangladesh"))] #[strum(serialize = "Bangladesh")] Bgd, + #[cfg_attr(feature = "backend", graphql(description = "Barbados"))] #[strum(serialize = "Barbados")] Brb, + #[cfg_attr(feature = "backend", graphql(description = "Belarus"))] #[strum(serialize = "Belarus")] Blr, + #[cfg_attr(feature = "backend", graphql(description = "Belgium"))] #[strum(serialize = "Belgium")] Bel, + #[cfg_attr(feature = "backend", graphql(description = "Belize"))] #[strum(serialize = "Belize")] Blz, + #[cfg_attr(feature = "backend", graphql(description = "Benin"))] #[strum(serialize = "Benin")] Ben, + #[cfg_attr(feature = "backend", graphql(description = "Bermuda"))] #[strum(serialize = "Bermuda")] Bmu, + #[cfg_attr(feature = "backend", graphql(description = "Bhutan"))] #[strum(serialize = "Bhutan")] Btn, + #[cfg_attr(feature = "backend", graphql(description = "Bolivia"))] #[strum(serialize = "Bolivia")] Bol, + #[cfg_attr( + feature = "backend", + graphql(description = "Bonaire, Sint Eustatius and Saba") + )] #[strum(serialize = "Bonaire, Sint Eustatius and Saba")] Bes, + #[cfg_attr(feature = "backend", graphql(description = "Bosnia and Herzegovina"))] #[strum(serialize = "Bosnia and Herzegovina")] Bih, + #[cfg_attr(feature = "backend", graphql(description = "Botswana"))] #[strum(serialize = "Botswana")] Bwa, + #[cfg_attr(feature = "backend", graphql(description = "Bouvet Island"))] #[strum(serialize = "Bouvet Island")] Bvt, + #[cfg_attr(feature = "backend", graphql(description = "Brazil"))] #[strum(serialize = "Brazil")] Bra, + #[cfg_attr( + feature = "backend", + graphql(description = "British Indian Ocean Territory") + )] #[strum(serialize = "British Indian Ocean Territory")] Iot, + #[cfg_attr(feature = "backend", graphql(description = "Brunei"))] #[strum(serialize = "Brunei")] Brn, + #[cfg_attr(feature = "backend", graphql(description = "Bulgaria"))] #[strum(serialize = "Bulgaria")] Bgr, + #[cfg_attr(feature = "backend", graphql(description = "Burkina Faso"))] #[strum(serialize = "Burkina Faso")] Bfa, + #[cfg_attr(feature = "backend", graphql(description = "Burundi"))] #[strum(serialize = "Burundi")] Bdi, + #[cfg_attr(feature = "backend", graphql(description = "Cabo Verde"))] #[strum(serialize = "Cabo Verde")] Cpv, + #[cfg_attr(feature = "backend", graphql(description = "Cambodia"))] #[strum(serialize = "Cambodia")] Khm, + #[cfg_attr(feature = "backend", graphql(description = "Cameroon"))] #[strum(serialize = "Cameroon")] Cmr, + #[cfg_attr(feature = "backend", graphql(description = "Canada"))] #[strum(serialize = "Canada")] Can, + #[cfg_attr(feature = "backend", graphql(description = "Cayman Islands"))] #[strum(serialize = "Cayman Islands")] Cym, + #[cfg_attr(feature = "backend", graphql(description = "Central African Republic"))] #[strum(serialize = "Central African Republic")] Caf, + #[cfg_attr(feature = "backend", graphql(description = "Chad"))] #[strum(serialize = "Chad")] Tcd, + #[cfg_attr(feature = "backend", graphql(description = "Chile"))] #[strum(serialize = "Chile")] Chl, + #[cfg_attr(feature = "backend", graphql(description = "China"))] #[strum(serialize = "China")] Chn, + #[cfg_attr(feature = "backend", graphql(description = "Christmas Island"))] #[strum(serialize = "Christmas Island")] Cxr, + #[cfg_attr(feature = "backend", graphql(description = "Cocos (Keeling) Islands"))] #[strum(serialize = "Cocos (Keeling) Islands")] Cck, + #[cfg_attr(feature = "backend", graphql(description = "Colombia"))] #[strum(serialize = "Colombia")] Col, + #[cfg_attr(feature = "backend", graphql(description = "Comoros"))] #[strum(serialize = "Comoros")] Com, + #[cfg_attr(feature = "backend", graphql(description = "Cook Islands"))] #[strum(serialize = "Cook Islands")] Cok, + #[cfg_attr(feature = "backend", graphql(description = "Costa Rica"))] #[strum(serialize = "Costa Rica")] Cri, + #[cfg_attr(feature = "backend", graphql(description = "Côte d'Ivoire"))] #[strum(serialize = "Côte d'Ivoire")] Civ, + #[cfg_attr(feature = "backend", graphql(description = "Croatia"))] #[strum(serialize = "Croatia")] Hrv, + #[cfg_attr(feature = "backend", graphql(description = "Cuba"))] #[strum(serialize = "Cuba")] Cub, + #[cfg_attr(feature = "backend", graphql(description = "Curaçao"))] #[strum(serialize = "Curaçao")] Cuw, + #[cfg_attr(feature = "backend", graphql(description = "Cyprus"))] #[strum(serialize = "Cyprus")] Cyp, + #[cfg_attr(feature = "backend", graphql(description = "Czechia"))] #[strum(serialize = "Czechia")] Cze, + #[cfg_attr( + feature = "backend", + graphql(description = "Democratic Republic of the Congo") + )] #[strum(serialize = "Democratic Republic of the Congo")] Cod, + #[cfg_attr(feature = "backend", graphql(description = "Denmark"))] #[strum(serialize = "Denmark")] Dnk, + #[cfg_attr(feature = "backend", graphql(description = "Djibouti"))] #[strum(serialize = "Djibouti")] Dji, + #[cfg_attr(feature = "backend", graphql(description = "Dominica"))] #[strum(serialize = "Dominica")] Dma, + #[cfg_attr(feature = "backend", graphql(description = "Dominican Republic"))] #[strum(serialize = "Dominican Republic")] Dom, + #[cfg_attr(feature = "backend", graphql(description = "Ecuador"))] #[strum(serialize = "Ecuador")] Ecu, + #[cfg_attr(feature = "backend", graphql(description = "Egypt"))] #[strum(serialize = "Egypt")] Egy, + #[cfg_attr(feature = "backend", graphql(description = "El Salvador"))] #[strum(serialize = "El Salvador")] Slv, + #[cfg_attr(feature = "backend", graphql(description = "Equatorial Guinea"))] #[strum(serialize = "Equatorial Guinea")] Gnq, + #[cfg_attr(feature = "backend", graphql(description = "Eritrea"))] #[strum(serialize = "Eritrea")] Eri, + #[cfg_attr(feature = "backend", graphql(description = "Estonia"))] #[strum(serialize = "Estonia")] Est, + #[cfg_attr(feature = "backend", graphql(description = "Eswatini"))] #[strum(serialize = "Eswatini")] Swz, + #[cfg_attr(feature = "backend", graphql(description = "Ethiopia"))] #[strum(serialize = "Ethiopia")] Eth, + #[cfg_attr(feature = "backend", graphql(description = "Falkland Islands"))] #[strum(serialize = "Falkland Islands")] Flk, + #[cfg_attr(feature = "backend", graphql(description = "Faroe Islands"))] #[strum(serialize = "Faroe Islands")] Fro, + #[cfg_attr(feature = "backend", graphql(description = "Fiji"))] #[strum(serialize = "Fiji")] Fji, + #[cfg_attr(feature = "backend", graphql(description = "Finland"))] #[strum(serialize = "Finland")] Fin, + #[cfg_attr(feature = "backend", graphql(description = "France"))] #[strum(serialize = "France")] Fra, + #[cfg_attr(feature = "backend", graphql(description = "French Guiana"))] #[strum(serialize = "French Guiana")] Guf, + #[cfg_attr(feature = "backend", graphql(description = "French Polynesia"))] #[strum(serialize = "French Polynesia")] Pyf, + #[cfg_attr( + feature = "backend", + graphql(description = "French Southern Territories") + )] #[strum(serialize = "French Southern Territories")] Atf, + #[cfg_attr(feature = "backend", graphql(description = "Gabon"))] #[strum(serialize = "Gabon")] Gab, + #[cfg_attr(feature = "backend", graphql(description = "Gambia"))] #[strum(serialize = "Gambia")] Gmb, + #[cfg_attr(feature = "backend", graphql(description = "Georgia"))] #[strum(serialize = "Georgia")] Geo, + #[cfg_attr(feature = "backend", graphql(description = "Germany"))] #[strum(serialize = "Germany")] Deu, + #[cfg_attr(feature = "backend", graphql(description = "Ghana"))] #[strum(serialize = "Ghana")] Gha, + #[cfg_attr(feature = "backend", graphql(description = "Gibraltar"))] #[strum(serialize = "Gibraltar")] Gib, + #[cfg_attr(feature = "backend", graphql(description = "Greece"))] #[strum(serialize = "Greece")] Grc, + #[cfg_attr(feature = "backend", graphql(description = "Greenland"))] #[strum(serialize = "Greenland")] Grl, + #[cfg_attr(feature = "backend", graphql(description = "Grenada"))] #[strum(serialize = "Grenada")] Grd, + #[cfg_attr(feature = "backend", graphql(description = "Guadeloupe"))] #[strum(serialize = "Guadeloupe")] Glp, + #[cfg_attr(feature = "backend", graphql(description = "Guam"))] #[strum(serialize = "Guam")] Gum, + #[cfg_attr(feature = "backend", graphql(description = "Guatemala"))] #[strum(serialize = "Guatemala")] Gtm, + #[cfg_attr(feature = "backend", graphql(description = "Guernsey"))] #[strum(serialize = "Guernsey")] Ggy, + #[cfg_attr(feature = "backend", graphql(description = "Guinea"))] #[strum(serialize = "Guinea")] Gin, + #[cfg_attr(feature = "backend", graphql(description = "Guinea-Bissau"))] #[strum(serialize = "Guinea-Bissau")] Gnb, + #[cfg_attr(feature = "backend", graphql(description = "Guyana"))] #[strum(serialize = "Guyana")] Guy, + #[cfg_attr(feature = "backend", graphql(description = "Haiti"))] #[strum(serialize = "Haiti")] Hti, + #[cfg_attr( + feature = "backend", + graphql(description = "Heard Island and McDonald Islands") + )] #[strum(serialize = "Heard Island and McDonald Islands")] Hmd, + #[cfg_attr(feature = "backend", graphql(description = "Honduras"))] #[strum(serialize = "Honduras")] Hnd, + #[cfg_attr(feature = "backend", graphql(description = "Hong Kong"))] #[strum(serialize = "Hong Kong")] Hkg, + #[cfg_attr(feature = "backend", graphql(description = "Hungary"))] #[strum(serialize = "Hungary")] Hun, + #[cfg_attr(feature = "backend", graphql(description = "Iceland"))] #[strum(serialize = "Iceland")] Isl, + #[cfg_attr(feature = "backend", graphql(description = "India"))] #[strum(serialize = "India")] Ind, + #[cfg_attr(feature = "backend", graphql(description = "Indonesia"))] #[strum(serialize = "Indonesia")] Idn, + #[cfg_attr(feature = "backend", graphql(description = "Iran"))] #[strum(serialize = "Iran")] Irn, + #[cfg_attr(feature = "backend", graphql(description = "Iraq"))] #[strum(serialize = "Iraq")] Irq, + #[cfg_attr(feature = "backend", graphql(description = "Ireland"))] #[strum(serialize = "Ireland")] Irl, + #[cfg_attr(feature = "backend", graphql(description = "Isle of Man"))] #[strum(serialize = "Isle of Man")] Imn, + #[cfg_attr(feature = "backend", graphql(description = "Israel"))] #[strum(serialize = "Israel")] Isr, + #[cfg_attr(feature = "backend", graphql(description = "Italy"))] #[strum(serialize = "Italy")] Ita, + #[cfg_attr(feature = "backend", graphql(description = "Jamaica"))] #[strum(serialize = "Jamaica")] Jam, + #[cfg_attr(feature = "backend", graphql(description = "Japan"))] #[strum(serialize = "Japan")] Jpn, + #[cfg_attr(feature = "backend", graphql(description = "Jersey"))] #[strum(serialize = "Jersey")] Jey, + #[cfg_attr(feature = "backend", graphql(description = "Jordan"))] #[strum(serialize = "Jordan")] Jor, + #[cfg_attr(feature = "backend", graphql(description = "Kazakhstan"))] #[strum(serialize = "Kazakhstan")] Kaz, + #[cfg_attr(feature = "backend", graphql(description = "Kenya"))] #[strum(serialize = "Kenya")] Ken, + #[cfg_attr(feature = "backend", graphql(description = "Kiribati"))] #[strum(serialize = "Kiribati")] Kir, + #[cfg_attr(feature = "backend", graphql(description = "Kuwait"))] #[strum(serialize = "Kuwait")] Kwt, + #[cfg_attr(feature = "backend", graphql(description = "Kyrgyzstan"))] #[strum(serialize = "Kyrgyzstan")] Kgz, + #[cfg_attr(feature = "backend", graphql(description = "Laos"))] #[strum(serialize = "Laos")] Lao, + #[cfg_attr(feature = "backend", graphql(description = "Latvia"))] #[strum(serialize = "Latvia")] Lva, + #[cfg_attr(feature = "backend", graphql(description = "Lebanon"))] #[strum(serialize = "Lebanon")] Lbn, + #[cfg_attr(feature = "backend", graphql(description = "Lesotho"))] #[strum(serialize = "Lesotho")] Lso, + #[cfg_attr(feature = "backend", graphql(description = "Liberia"))] #[strum(serialize = "Liberia")] Lbr, + #[cfg_attr(feature = "backend", graphql(description = "Libya"))] #[strum(serialize = "Libya")] Lby, + #[cfg_attr(feature = "backend", graphql(description = "Liechtenstein"))] #[strum(serialize = "Liechtenstein")] Lie, + #[cfg_attr(feature = "backend", graphql(description = "Lithuania"))] #[strum(serialize = "Lithuania")] Ltu, + #[cfg_attr(feature = "backend", graphql(description = "Luxembourg"))] #[strum(serialize = "Luxembourg")] Lux, + #[cfg_attr(feature = "backend", graphql(description = "Macao"))] #[strum(serialize = "Macao")] Mac, + #[cfg_attr(feature = "backend", graphql(description = "Madagascar"))] #[strum(serialize = "Madagascar")] Mdg, + #[cfg_attr(feature = "backend", graphql(description = "Malawi"))] #[strum(serialize = "Malawi")] Mwi, + #[cfg_attr(feature = "backend", graphql(description = "Malaysia"))] #[strum(serialize = "Malaysia")] Mys, + #[cfg_attr(feature = "backend", graphql(description = "Maldives"))] #[strum(serialize = "Maldives")] Mdv, + #[cfg_attr(feature = "backend", graphql(description = "Mali"))] #[strum(serialize = "Mali")] Mli, + #[cfg_attr(feature = "backend", graphql(description = "Malta"))] #[strum(serialize = "Malta")] Mlt, + #[cfg_attr(feature = "backend", graphql(description = "Marshall Islands"))] #[strum(serialize = "Marshall Islands")] Mhl, + #[cfg_attr(feature = "backend", graphql(description = "Martinique"))] #[strum(serialize = "Martinique")] Mtq, + #[cfg_attr(feature = "backend", graphql(description = "Mauritania"))] #[strum(serialize = "Mauritania")] Mrt, + #[cfg_attr(feature = "backend", graphql(description = "Mauritius"))] #[strum(serialize = "Mauritius")] Mus, + #[cfg_attr(feature = "backend", graphql(description = "Mayotte"))] #[strum(serialize = "Mayotte")] Myt, + #[cfg_attr(feature = "backend", graphql(description = "Mexico"))] #[strum(serialize = "Mexico")] Mex, + #[cfg_attr(feature = "backend", graphql(description = "Micronesia"))] #[strum(serialize = "Micronesia")] Fsm, + #[cfg_attr(feature = "backend", graphql(description = "Moldova"))] #[strum(serialize = "Moldova")] Mda, + #[cfg_attr(feature = "backend", graphql(description = "Monaco"))] #[strum(serialize = "Monaco")] Mco, + #[cfg_attr(feature = "backend", graphql(description = "Mongolia"))] #[strum(serialize = "Mongolia")] Mng, + #[cfg_attr(feature = "backend", graphql(description = "Montenegro"))] #[strum(serialize = "Montenegro")] Mne, + #[cfg_attr(feature = "backend", graphql(description = "Montserrat"))] #[strum(serialize = "Montserrat")] Msr, + #[cfg_attr(feature = "backend", graphql(description = "Morocco"))] #[strum(serialize = "Morocco")] Mar, + #[cfg_attr(feature = "backend", graphql(description = "Mozambique"))] #[strum(serialize = "Mozambique")] Moz, + #[cfg_attr(feature = "backend", graphql(description = "Myanmar"))] #[strum(serialize = "Myanmar")] Mmr, + #[cfg_attr(feature = "backend", graphql(description = "Namibia"))] #[strum(serialize = "Namibia")] Nam, + #[cfg_attr(feature = "backend", graphql(description = "Nauru"))] #[strum(serialize = "Nauru")] Nru, + #[cfg_attr(feature = "backend", graphql(description = "Nepal"))] #[strum(serialize = "Nepal")] Npl, + #[cfg_attr(feature = "backend", graphql(description = "Netherlands"))] #[strum(serialize = "Netherlands")] Nld, + #[cfg_attr(feature = "backend", graphql(description = "New Caledonia"))] #[strum(serialize = "New Caledonia")] Ncl, + #[cfg_attr(feature = "backend", graphql(description = "New Zealand"))] #[strum(serialize = "New Zealand")] Nzl, + #[cfg_attr(feature = "backend", graphql(description = "Nicaragua"))] #[strum(serialize = "Nicaragua")] Nic, + #[cfg_attr(feature = "backend", graphql(description = "Niger"))] #[strum(serialize = "Niger")] Ner, + #[cfg_attr(feature = "backend", graphql(description = "Nigeria"))] #[strum(serialize = "Nigeria")] Nga, + #[cfg_attr(feature = "backend", graphql(description = "Niue"))] #[strum(serialize = "Niue")] Niu, + #[cfg_attr(feature = "backend", graphql(description = "Norfolk Island"))] #[strum(serialize = "Norfolk Island")] Nfk, + #[cfg_attr(feature = "backend", graphql(description = "North Korea"))] #[strum(serialize = "North Korea")] Prk, + #[cfg_attr(feature = "backend", graphql(description = "North Macedonia"))] #[strum(serialize = "North Macedonia")] Mkd, + #[cfg_attr(feature = "backend", graphql(description = "Northern Mariana Islands"))] #[strum(serialize = "Northern Mariana Islands")] Mnp, + #[cfg_attr(feature = "backend", graphql(description = "Norway"))] #[strum(serialize = "Norway")] Nor, + #[cfg_attr(feature = "backend", graphql(description = "Oman"))] #[strum(serialize = "Oman")] Omn, + #[cfg_attr(feature = "backend", graphql(description = "Pakistan"))] #[strum(serialize = "Pakistan")] Pak, + #[cfg_attr(feature = "backend", graphql(description = "Palau"))] #[strum(serialize = "Palau")] Plw, + #[cfg_attr(feature = "backend", graphql(description = "Palestine"))] #[strum(serialize = "Palestine")] Pse, + #[cfg_attr(feature = "backend", graphql(description = "Panama"))] #[strum(serialize = "Panama")] Pan, + #[cfg_attr(feature = "backend", graphql(description = "Papua New Guinea"))] #[strum(serialize = "Papua New Guinea")] Png, + #[cfg_attr(feature = "backend", graphql(description = "Paraguay"))] #[strum(serialize = "Paraguay")] Pry, + #[cfg_attr(feature = "backend", graphql(description = "Peru"))] #[strum(serialize = "Peru")] Per, + #[cfg_attr(feature = "backend", graphql(description = "Philippines"))] #[strum(serialize = "Philippines")] Phl, + #[cfg_attr(feature = "backend", graphql(description = "Pitcairn"))] #[strum(serialize = "Pitcairn")] Pcn, + #[cfg_attr(feature = "backend", graphql(description = "Poland"))] #[strum(serialize = "Poland")] Pol, + #[cfg_attr(feature = "backend", graphql(description = "Portugal"))] #[strum(serialize = "Portugal")] Prt, + #[cfg_attr(feature = "backend", graphql(description = "Puerto Rico"))] #[strum(serialize = "Puerto Rico")] Pri, + #[cfg_attr(feature = "backend", graphql(description = "Qatar"))] #[strum(serialize = "Qatar")] Qat, + #[cfg_attr(feature = "backend", graphql(description = "Republic of the Congo"))] #[strum(serialize = "Republic of the Congo")] Cog, + #[cfg_attr(feature = "backend", graphql(description = "Réunion"))] #[strum(serialize = "Réunion")] Reu, + #[cfg_attr(feature = "backend", graphql(description = "Romania"))] #[strum(serialize = "Romania")] Rou, + #[cfg_attr(feature = "backend", graphql(description = "Russia"))] #[strum(serialize = "Russia")] Rus, + #[cfg_attr(feature = "backend", graphql(description = "Rwanda"))] #[strum(serialize = "Rwanda")] Rwa, + #[cfg_attr(feature = "backend", graphql(description = "Saint Barthélemy"))] #[strum(serialize = "Saint Barthélemy")] Blm, + #[cfg_attr( + feature = "backend", + graphql(description = "Saint Helena, Ascension and Tristan da Cunha") + )] #[strum(serialize = "Saint Helena, Ascension and Tristan da Cunha")] Shn, + #[cfg_attr(feature = "backend", graphql(description = "Saint Kitts and Nevis"))] #[strum(serialize = "Saint Kitts and Nevis")] Kna, + #[cfg_attr(feature = "backend", graphql(description = "Saint Lucia"))] #[strum(serialize = "Saint Lucia")] Lca, + #[cfg_attr(feature = "backend", graphql(description = "Saint Martin"))] #[strum(serialize = "Saint Martin")] Maf, + #[cfg_attr( + feature = "backend", + graphql(description = "Saint Pierre and Miquelon") + )] #[strum(serialize = "Saint Pierre and Miquelon")] Spm, + #[cfg_attr( + feature = "backend", + graphql(description = "Saint Vincent and the Grenadines") + )] #[strum(serialize = "Saint Vincent and the Grenadines")] Vct, + #[cfg_attr(feature = "backend", graphql(description = "Samoa"))] #[strum(serialize = "Samoa")] Wsm, + #[cfg_attr(feature = "backend", graphql(description = "San Marino"))] #[strum(serialize = "San Marino")] Smr, + #[cfg_attr(feature = "backend", graphql(description = "Sao Tome and Principe"))] #[strum(serialize = "Sao Tome and Principe")] Stp, + #[cfg_attr(feature = "backend", graphql(description = "Saudi Arabia"))] #[strum(serialize = "Saudi Arabia")] Sau, + #[cfg_attr(feature = "backend", graphql(description = "Senegal"))] #[strum(serialize = "Senegal")] Sen, + #[cfg_attr(feature = "backend", graphql(description = "Serbia"))] #[strum(serialize = "Serbia")] Srb, + #[cfg_attr(feature = "backend", graphql(description = "Seychelles"))] #[strum(serialize = "Seychelles")] Syc, + #[cfg_attr(feature = "backend", graphql(description = "Sierra Leone"))] #[strum(serialize = "Sierra Leone")] Sle, + #[cfg_attr(feature = "backend", graphql(description = "Singapore"))] #[strum(serialize = "Singapore")] Sgp, + #[cfg_attr(feature = "backend", graphql(description = "Sint Maarten"))] #[strum(serialize = "Sint Maarten")] Sxm, + #[cfg_attr(feature = "backend", graphql(description = "Slovakia"))] #[strum(serialize = "Slovakia")] Svk, + #[cfg_attr(feature = "backend", graphql(description = "Slovenia"))] #[strum(serialize = "Slovenia")] Svn, + #[cfg_attr(feature = "backend", graphql(description = "Solomon Islands"))] #[strum(serialize = "Solomon Islands")] Slb, + #[cfg_attr(feature = "backend", graphql(description = "Somalia"))] #[strum(serialize = "Somalia")] Som, + #[cfg_attr(feature = "backend", graphql(description = "South Africa"))] #[strum(serialize = "South Africa")] Zaf, + #[cfg_attr( + feature = "backend", + graphql(description = "South Georgia and the South Sandwich Islands") + )] #[strum(serialize = "South Georgia and the South Sandwich Islands")] Sgs, + #[cfg_attr(feature = "backend", graphql(description = "South Korea"))] #[strum(serialize = "South Korea")] Kor, + #[cfg_attr(feature = "backend", graphql(description = "South Sudan"))] #[strum(serialize = "South Sudan")] Ssd, + #[cfg_attr(feature = "backend", graphql(description = "Spain"))] #[strum(serialize = "Spain")] Esp, + #[cfg_attr(feature = "backend", graphql(description = "Sri Lanka"))] #[strum(serialize = "Sri Lanka")] Lka, + #[cfg_attr(feature = "backend", graphql(description = "Sudan"))] #[strum(serialize = "Sudan")] Sdn, + #[cfg_attr(feature = "backend", graphql(description = "Suriname"))] #[strum(serialize = "Suriname")] Sur, + #[cfg_attr(feature = "backend", graphql(description = "Svalbard and Jan Mayen"))] #[strum(serialize = "Svalbard and Jan Mayen")] Sjm, + #[cfg_attr(feature = "backend", graphql(description = "Sweden"))] #[strum(serialize = "Sweden")] Swe, + #[cfg_attr(feature = "backend", graphql(description = "Switzerland"))] #[strum(serialize = "Switzerland")] Che, + #[cfg_attr(feature = "backend", graphql(description = "Syria"))] #[strum(serialize = "Syria")] Syr, + #[cfg_attr(feature = "backend", graphql(description = "Taiwan"))] #[strum(serialize = "Taiwan")] Twn, + #[cfg_attr(feature = "backend", graphql(description = "Tajikistan"))] #[strum(serialize = "Tajikistan")] Tjk, + #[cfg_attr(feature = "backend", graphql(description = "Tanzania"))] #[strum(serialize = "Tanzania")] Tza, + #[cfg_attr(feature = "backend", graphql(description = "Thailand"))] #[strum(serialize = "Thailand")] Tha, + #[cfg_attr(feature = "backend", graphql(description = "Timor-Leste"))] #[strum(serialize = "Timor-Leste")] Tls, + #[cfg_attr(feature = "backend", graphql(description = "Togo"))] #[strum(serialize = "Togo")] Tgo, + #[cfg_attr(feature = "backend", graphql(description = "Tokelau"))] #[strum(serialize = "Tokelau")] Tkl, + #[cfg_attr(feature = "backend", graphql(description = "Tonga"))] #[strum(serialize = "Tonga")] Ton, + #[cfg_attr(feature = "backend", graphql(description = "Trinidad and Tobago"))] #[strum(serialize = "Trinidad and Tobago")] Tto, + #[cfg_attr(feature = "backend", graphql(description = "Tunisia"))] #[strum(serialize = "Tunisia")] Tun, + #[cfg_attr(feature = "backend", graphql(description = "Turkey"))] #[strum(serialize = "Turkey")] Tur, + #[cfg_attr(feature = "backend", graphql(description = "Turkmenistan"))] #[strum(serialize = "Turkmenistan")] Tkm, + #[cfg_attr(feature = "backend", graphql(description = "Turks and Caicos Islands"))] #[strum(serialize = "Turks and Caicos Islands")] Tca, + #[cfg_attr(feature = "backend", graphql(description = "Tuvalu"))] #[strum(serialize = "Tuvalu")] Tuv, + #[cfg_attr(feature = "backend", graphql(description = "Uganda"))] #[strum(serialize = "Uganda")] Uga, + #[cfg_attr(feature = "backend", graphql(description = "Ukraine"))] #[strum(serialize = "Ukraine")] Ukr, + #[cfg_attr(feature = "backend", graphql(description = "United Arab Emirates"))] #[strum(serialize = "United Arab Emirates")] Are, + #[cfg_attr(feature = "backend", graphql(description = "United Kingdom"))] #[strum(serialize = "United Kingdom")] Gbr, + #[cfg_attr( + feature = "backend", + graphql(description = "United States Minor Outlying Islands") + )] #[strum(serialize = "United States Minor Outlying Islands")] Umi, + #[cfg_attr(feature = "backend", graphql(description = "United States of America"))] #[strum(serialize = "United States of America")] Usa, + #[cfg_attr(feature = "backend", graphql(description = "Uruguay"))] #[strum(serialize = "Uruguay")] Ury, + #[cfg_attr(feature = "backend", graphql(description = "Uzbekistan"))] #[strum(serialize = "Uzbekistan")] Uzb, + #[cfg_attr(feature = "backend", graphql(description = "Vanuatu"))] #[strum(serialize = "Vanuatu")] Vut, + #[cfg_attr(feature = "backend", graphql(description = "Vatican City"))] #[strum(serialize = "Vatican City")] Vat, + #[cfg_attr(feature = "backend", graphql(description = "Venezuela"))] #[strum(serialize = "Venezuela")] Ven, + #[cfg_attr(feature = "backend", graphql(description = "Viet Nam"))] #[strum(serialize = "Viet Nam")] Vnm, + #[cfg_attr(feature = "backend", graphql(description = "Virgin Islands (British)"))] #[strum(serialize = "Virgin Islands (British)")] Vgb, + #[cfg_attr(feature = "backend", graphql(description = "Virgin Islands (U.S.)"))] #[strum(serialize = "Virgin Islands (U.S.)")] Vir, + #[cfg_attr(feature = "backend", graphql(description = "Wallis and Futuna"))] #[strum(serialize = "Wallis and Futuna")] Wlf, + #[cfg_attr(feature = "backend", graphql(description = "Western Sahara"))] #[strum(serialize = "Western Sahara")] Esh, + #[cfg_attr(feature = "backend", graphql(description = "Yemen"))] #[strum(serialize = "Yemen")] Yem, + #[cfg_attr(feature = "backend", graphql(description = "Zambia"))] #[strum(serialize = "Zambia")] Zmb, + #[cfg_attr(feature = "backend", graphql(description = "Zimbabwe"))] #[strum(serialize = "Zimbabwe")] Zwe, } diff --git a/thoth-api/src/model/language/mod.rs b/thoth-api/src/model/language/mod.rs index b025316a2..b4ad94e73 100644 --- a/thoth-api/src/model/language/mod.rs +++ b/thoth-api/src/model/language/mod.rs @@ -12,18 +12,32 @@ use crate::schema::language_history; #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), - graphql(description = "Relation between a language and the original language of a text"), + graphql( + description = "Relation between a language listed for a work and the original language of a text" + ), ExistingTypePath = "crate::schema::sql_types::LanguageRelation" )] #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[strum(serialize_all = "title_case")] pub enum LanguageRelation { + #[cfg_attr( + feature = "backend", + graphql(description = "Original language of the text") + )] #[default] Original, - #[cfg_attr(feature = "backend", db_rename = "translated-from")] + #[cfg_attr( + feature = "backend", + db_rename = "translated-from", + graphql(description = "Language from which the text was translated") + )] TranslatedFrom, - #[cfg_attr(feature = "backend", db_rename = "translated-into")] + #[cfg_attr( + feature = "backend", + db_rename = "translated-into", + graphql(description = "Language into which the text has been translated") + )] TranslatedInto, } diff --git a/thoth-api/src/model/location/mod.rs b/thoth-api/src/model/location/mod.rs index b02543e3c..c1cdba859 100644 --- a/thoth-api/src/model/location/mod.rs +++ b/thoth-api/src/model/location/mod.rs @@ -19,55 +19,127 @@ use crate::schema::location_history; #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum LocationPlatform { - #[cfg_attr(feature = "backend", db_rename = "Project MUSE")] + #[cfg_attr( + feature = "backend", + db_rename = "Project MUSE", + graphql(description = "Project MUSE: https://muse.jhu.edu") + )] #[strum(serialize = "Project MUSE")] ProjectMuse, - #[cfg_attr(feature = "backend", db_rename = "OAPEN")] + #[cfg_attr( + feature = "backend", + db_rename = "OAPEN", + graphql( + description = "OAPEN (Open Access Publishing in European Networks): https://oapen.org" + ) + )] #[strum(serialize = "OAPEN")] Oapen, - #[cfg_attr(feature = "backend", db_rename = "DOAB")] + #[cfg_attr( + feature = "backend", + db_rename = "DOAB", + graphql(description = "DOAB (Directory of Open Access Books): https://doabooks.org") + )] #[strum(serialize = "DOAB")] Doab, - #[cfg_attr(feature = "backend", db_rename = "JSTOR")] + #[cfg_attr( + feature = "backend", + db_rename = "JSTOR", + graphql(description = "JSTOR: https://jstor.org") + )] #[strum(serialize = "JSTOR")] Jstor, - #[cfg_attr(feature = "backend", db_rename = "EBSCO Host")] + #[cfg_attr( + feature = "backend", + db_rename = "EBSCO Host", + graphql(description = "EBSCO Host") + )] #[strum(serialize = "EBSCO Host")] EbscoHost, - #[cfg_attr(feature = "backend", db_rename = "OCLC KB")] + #[cfg_attr( + feature = "backend", + db_rename = "OCLC KB", + graphql(description = "OCLC Knowledge Base") + )] #[strum(serialize = "OCLC KB")] OclcKb, - #[cfg_attr(feature = "backend", db_rename = "ProQuest KB")] + #[cfg_attr( + feature = "backend", + db_rename = "ProQuest KB", + graphql(description = "ProQuest Knowledge Base") + )] #[strum(serialize = "ProQuest KB")] ProquestKb, - #[cfg_attr(feature = "backend", db_rename = "ProQuest ExLibris")] + #[cfg_attr( + feature = "backend", + db_rename = "ProQuest ExLibris", + graphql(description = "ProQuest ExLibris") + )] #[strum(serialize = "ProQuest ExLibris")] ProquestExlibris, - #[cfg_attr(feature = "backend", db_rename = "EBSCO KB")] + #[cfg_attr( + feature = "backend", + db_rename = "EBSCO KB", + graphql(description = "EBSCO Knowledge Base") + )] #[strum(serialize = "EBSCO KB")] EbscoKb, - #[cfg_attr(feature = "backend", db_rename = "JISC KB")] + #[cfg_attr( + feature = "backend", + db_rename = "JISC KB", + graphql(description = "JISC Knowledge Base") + )] #[strum(serialize = "JISC KB")] JiscKb, - #[cfg_attr(feature = "backend", db_rename = "Google Books")] + #[cfg_attr( + feature = "backend", + db_rename = "Google Books", + graphql(description = "Google Books: https://books.google.com") + )] #[strum(serialize = "Google Books")] GoogleBooks, - #[cfg_attr(feature = "backend", db_rename = "Internet Archive")] + #[cfg_attr( + feature = "backend", + db_rename = "Internet Archive", + graphql(description = "Internet Archive: https://archive.org") + )] #[strum(serialize = "Internet Archive")] InternetArchive, - #[cfg_attr(feature = "backend", db_rename = "ScienceOpen")] + #[cfg_attr( + feature = "backend", + db_rename = "ScienceOpen", + graphql(description = "ScienceOpen: https://scienceopen.com") + )] #[strum(serialize = "ScienceOpen")] ScienceOpen, - #[cfg_attr(feature = "backend", db_rename = "SciELO Books")] + #[cfg_attr( + feature = "backend", + db_rename = "SciELO Books", + graphql( + description = "SciELO (Scientific Electronic Library Online) Books: https://books.scielo.org" + ) + )] #[strum(serialize = "SciELO Books")] ScieloBooks, - #[cfg_attr(feature = "backend", db_rename = "Zenodo")] + #[cfg_attr( + feature = "backend", + db_rename = "Zenodo", + graphql(description = "Zenodo: https://zenodo.org") + )] #[strum(serialize = "Zenodo")] Zenodo, - #[cfg_attr(feature = "backend", db_rename = "Publisher Website")] + #[cfg_attr( + feature = "backend", + db_rename = "Publisher Website", + graphql(description = "Publisher's own website") + )] #[strum(serialize = "Publisher Website")] PublisherWebsite, - #[cfg_attr(feature = "backend", db_rename = "Other")] + #[cfg_attr( + feature = "backend", + db_rename = "Other", + graphql(description = "Another hosting platform not listed above") + )] #[default] Other, } diff --git a/thoth-api/src/model/mod.rs b/thoth-api/src/model/mod.rs index 9821c61f0..3ac8ff8ec 100644 --- a/thoth-api/src/model/mod.rs +++ b/thoth-api/src/model/mod.rs @@ -22,9 +22,12 @@ pub const ROR_DOMAIN: &str = "https://ror.org/"; #[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[strum(serialize_all = "lowercase")] pub enum LengthUnit { + #[cfg_attr(feature = "backend", graphql(description = "Millimetres"))] #[default] Mm, + #[cfg_attr(feature = "backend", graphql(description = "Centimetres"))] Cm, + #[cfg_attr(feature = "backend", graphql(description = "Inches"))] In, } @@ -37,8 +40,10 @@ pub enum LengthUnit { #[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[strum(serialize_all = "lowercase")] pub enum WeightUnit { + #[cfg_attr(feature = "backend", graphql(description = "Grams"))] #[default] G, + #[cfg_attr(feature = "backend", graphql(description = "Ounces"))] Oz, } diff --git a/thoth-api/src/model/publication/mod.rs b/thoth-api/src/model/publication/mod.rs index c2a45cc5f..4c061a102 100644 --- a/thoth-api/src/model/publication/mod.rs +++ b/thoth-api/src/model/publication/mod.rs @@ -24,36 +24,84 @@ use crate::schema::publication_history; #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum PublicationType { - #[cfg_attr(feature = "backend", db_rename = "Paperback")] + #[cfg_attr( + feature = "backend", + db_rename = "Paperback", + graphql(description = "Paperback print format") + )] #[default] Paperback, - #[cfg_attr(feature = "backend", db_rename = "Hardback")] + #[cfg_attr( + feature = "backend", + db_rename = "Hardback", + graphql(description = "Hardback print format") + )] Hardback, - #[cfg_attr(feature = "backend", db_rename = "PDF")] + #[cfg_attr( + feature = "backend", + db_rename = "PDF", + graphql(description = "PDF ebook format") + )] #[strum(serialize = "PDF")] Pdf, - #[cfg_attr(feature = "backend", db_rename = "HTML")] + #[cfg_attr( + feature = "backend", + db_rename = "HTML", + graphql(description = "HTML ebook format") + )] #[strum(serialize = "HTML")] Html, - #[cfg_attr(feature = "backend", db_rename = "XML")] + #[cfg_attr( + feature = "backend", + db_rename = "XML", + graphql(description = "XML ebook format") + )] #[strum(serialize = "XML")] Xml, - #[cfg_attr(feature = "backend", db_rename = "Epub")] + #[cfg_attr( + feature = "backend", + db_rename = "Epub", + graphql(description = "Epub ebook format") + )] Epub, - #[cfg_attr(feature = "backend", db_rename = "Mobi")] + #[cfg_attr( + feature = "backend", + db_rename = "Mobi", + graphql(description = "Mobipocket (.mobi) ebook format") + )] Mobi, - #[cfg_attr(feature = "backend", db_rename = "AZW3")] + #[cfg_attr( + feature = "backend", + db_rename = "AZW3", + graphql(description = "Kindle version 8 (.azw3) ebook format") + )] #[strum(serialize = "AZW3")] Azw3, - #[cfg_attr(feature = "backend", db_rename = "DOCX")] + #[cfg_attr( + feature = "backend", + db_rename = "DOCX", + graphql(description = "Microsoft Word (.docx) ebook format") + )] #[strum(serialize = "DOCX")] Docx, - #[cfg_attr(feature = "backend", db_rename = "FictionBook")] + #[cfg_attr( + feature = "backend", + db_rename = "FictionBook", + graphql(description = "FictionBook (.fb2, .fb3, .fbz) ebook format") + )] FictionBook, - #[cfg_attr(feature = "backend", db_rename = "MP3")] + #[cfg_attr( + feature = "backend", + db_rename = "MP3", + graphql(description = "MP3 audiobook format") + )] #[strum(serialize = "MP3")] Mp3, - #[cfg_attr(feature = "backend", db_rename = "WAV")] + #[cfg_attr( + feature = "backend", + db_rename = "WAV", + graphql(description = "WAV audiobook format") + )] #[strum(serialize = "WAV")] Wav, } diff --git a/thoth-api/src/model/series/mod.rs b/thoth-api/src/model/series/mod.rs index 27e16ed1a..ec1da46b6 100644 --- a/thoth-api/src/model/series/mod.rs +++ b/thoth-api/src/model/series/mod.rs @@ -22,8 +22,18 @@ use crate::schema::series_history; #[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[strum(serialize_all = "title_case")] pub enum SeriesType { + #[cfg_attr( + feature = "backend", + graphql( + description = "A set of collections of articles on a specific topic, published periodically" + ) + )] Journal, - #[cfg_attr(feature = "backend", db_rename = "book-series")] + #[cfg_attr( + feature = "backend", + db_rename = "book-series", + graphql(description = "A set of related books, published periodically") + )] #[default] BookSeries, } diff --git a/thoth-api/src/model/work/mod.rs b/thoth-api/src/model/work/mod.rs index df442caa3..f62abd458 100644 --- a/thoth-api/src/model/work/mod.rs +++ b/thoth-api/src/model/work/mod.rs @@ -33,16 +33,42 @@ use crate::schema::work_history; #[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[strum(serialize_all = "title_case")] pub enum WorkType { - #[cfg_attr(feature = "backend", db_rename = "book-chapter")] + #[cfg_attr( + feature = "backend", + db_rename = "book-chapter", + graphql(description = "Section of a larger parent work") + )] BookChapter, #[default] + #[cfg_attr( + feature = "backend", + graphql(description = "Long-form work on a single theme, by a small number of authors") + )] Monograph, - #[cfg_attr(feature = "backend", db_rename = "edited-book")] + #[cfg_attr( + feature = "backend", + db_rename = "edited-book", + graphql(description = "Collection of short works by different authors on a single theme") + )] EditedBook, + #[cfg_attr( + feature = "backend", + graphql(description = "Work used for educational purposes") + )] Textbook, - #[cfg_attr(feature = "backend", db_rename = "journal-issue")] + #[cfg_attr( + feature = "backend", + db_rename = "journal-issue", + graphql( + description = "Single publication within a series of collections of related articles" + ) + )] JournalIssue, - #[cfg_attr(feature = "backend", db_rename = "book-set")] + #[cfg_attr( + feature = "backend", + db_rename = "book-set", + graphql(description = "Group of volumes published together forming a single work") + )] BookSet, } diff --git a/thoth-api/src/model/work_relation/mod.rs b/thoth-api/src/model/work_relation/mod.rs index 5774022af..ce17c0e64 100644 --- a/thoth-api/src/model/work_relation/mod.rs +++ b/thoth-api/src/model/work_relation/mod.rs @@ -23,21 +23,69 @@ use crate::schema::work_relation_history; #[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[strum(serialize_all = "title_case")] pub enum RelationType { + #[cfg_attr( + feature = "backend", + graphql( + description = "The work to which this relation belongs replaces the work identified within the relation" + ) + )] Replaces, - #[cfg_attr(feature = "backend", db_rename = "has-translation")] + #[cfg_attr( + feature = "backend", + db_rename = "has-translation", + graphql( + description = "The work to which this relation belongs is translated by the work identified within the relation" + ) + )] HasTranslation, - #[cfg_attr(feature = "backend", db_rename = "has-part")] + #[cfg_attr( + feature = "backend", + db_rename = "has-part", + graphql( + description = "The work to which this relation belongs contains the work (part) identified within the relation" + ) + )] HasPart, - #[cfg_attr(feature = "backend", db_rename = "has-child")] + #[cfg_attr( + feature = "backend", + db_rename = "has-child", + graphql( + description = "The work to which this relation belongs contains the work (chapter) identified within the relation" + ) + )] #[default] HasChild, - #[cfg_attr(feature = "backend", db_rename = "is-replaced-by")] + #[cfg_attr( + feature = "backend", + db_rename = "is-replaced-by", + graphql( + description = "The work to which this relation belongs is replaced by the work identified within the relation" + ) + )] IsReplacedBy, - #[cfg_attr(feature = "backend", db_rename = "is-translation-of")] + #[cfg_attr( + feature = "backend", + db_rename = "is-translation-of", + graphql( + description = "The work to which this relation belongs is a translation of the work identified within the relation" + ) + )] IsTranslationOf, - #[cfg_attr(feature = "backend", db_rename = "is-part-of")] + #[cfg_attr( + feature = "backend", + db_rename = "is-part-of", + graphql( + description = "The work to which this relation belongs is a component (part) of the work identified within the relation" + ) + )] IsPartOf, - #[cfg_attr(feature = "backend", db_rename = "is-child-of")] + #[cfg_attr( + feature = "backend", + db_rename = "is-child-of", + graphql( + description = "The work to which this relation belongs is a component (chapter) of the work identified within the relation" + ) + )] IsChildOf, } From 8590bf8006767c2978194b9ad496a540053b0823 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 3 Sep 2024 14:40:31 +0100 Subject: [PATCH 6/7] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3494b12c..113b3ee1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added + - [574](https://github.com/thoth-pub/thoth/issues/574) - Add descriptions to all remaining items in schema ## [[0.12.7]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.7) - 2024-08-28 ### Changed From 126fcc3faaed8386969553203bbb823589cf73f8 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:05:05 +0100 Subject: [PATCH 7/7] Minor wording tweaks --- thoth-api/src/graphql/model.rs | 32 ++++++++++++------------ thoth-api/src/graphql/utils.rs | 14 ++++++----- thoth-api/src/model/funding/mod.rs | 4 +-- thoth-api/src/model/language/mod.rs | 2 +- thoth-api/src/model/location/mod.rs | 4 +-- thoth-api/src/model/work_relation/mod.rs | 16 ++++++------ 6 files changed, 37 insertions(+), 35 deletions(-) diff --git a/thoth-api/src/graphql/model.rs b/thoth-api/src/graphql/model.rs index 9538efbf8..4d54dc433 100644 --- a/thoth-api/src/graphql/model.rs +++ b/thoth-api/src/graphql/model.rs @@ -2434,7 +2434,7 @@ impl Work { } #[graphql( - description = "Digital Object Identifier of the work as full URL. It must use the HTTPS scheme and the doi.org domain (e.g. https://doi.org/10.11647/obp.0001)" + description = "Digital Object Identifier of the work as full URL, using the HTTPS scheme and the doi.org domain (e.g. https://doi.org/10.11647/obp.0001)" )] pub fn doi(&self) -> Option<&Doi> { self.doi.as_ref() @@ -3261,7 +3261,7 @@ impl Contributor { } #[graphql( - description = "ORCID (Open Researcher and Contributor ID) of the contributor as full URL. It must use the HTTPS scheme and the orcid.org domain (e.g. https://orcid.org/0000-0002-1825-0097)" + description = "ORCID (Open Researcher and Contributor ID) of the contributor as full URL, using the HTTPS scheme and the orcid.org domain (e.g. https://orcid.org/0000-0002-1825-0097)" )] pub fn orcid(&self) -> Option<&Orcid> { self.orcid.as_ref() @@ -3634,7 +3634,7 @@ impl Location { self.full_text_url.as_ref() } - #[graphql(description = "Platform on which the publication is hosted")] + #[graphql(description = "Platform where the publication is hosted or can be acquired")] pub fn location_platform(&self) -> &LocationPlatform { &self.location_platform } @@ -3681,7 +3681,7 @@ impl Price { &self.currency_code } - #[graphql(description = "Value of the publication in the selected currency")] + #[graphql(description = "Value of the publication in the specified currency")] pub fn unit_price(&self) -> f64 { self.unit_price } @@ -3709,7 +3709,7 @@ impl Subject { &self.subject_id } - #[graphql(description = "Thoth ID of the work to which the subject is related")] + #[graphql(description = "Thoth ID of the work to which the subject is linked")] pub fn work_id(&self) -> &Uuid { &self.work_id } @@ -3719,13 +3719,13 @@ impl Subject { &self.subject_type } - #[graphql(description = "Code representing the subject within the selected type")] + #[graphql(description = "Code representing the subject within the specified type")] pub fn subject_code(&self) -> &String { &self.subject_code } #[graphql( - description = "Number representing this subject's position in an ordered list of subjects of the same type within the work" + description = "Number representing this subject's position in an ordered list of subjects of the same type within the work (subjects of equal prominence can have the same number)" )] pub fn subject_ordinal(&self) -> &i32 { &self.subject_ordinal @@ -3741,7 +3741,7 @@ impl Subject { self.updated_at.clone() } - #[graphql(description = "Get the work to which the subject is related")] + #[graphql(description = "Get the work to which the subject is linked")] pub fn work(&self, context: &Context) -> FieldResult { Work::from_id(&context.db, &self.work_id).map_err(|e| e.into()) } @@ -3760,7 +3760,7 @@ impl Institution { } #[graphql( - description = "Digital Object Identifier of the organisation as full URL. It must use the HTTPS scheme and the doi.org domain (e.g. https://doi.org/10.13039/100014013)" + description = "Digital Object Identifier of the organisation as full URL, using the HTTPS scheme and the doi.org domain (e.g. https://doi.org/10.13039/100014013)" )] pub fn institution_doi(&self) -> Option<&Doi> { self.institution_doi.as_ref() @@ -3774,7 +3774,7 @@ impl Institution { } #[graphql( - description = "Research Organisation Registry identifier of the organisation as full URL. It must use the HTTPS scheme and the ror.org domain (e.g. https://ror.org/051z6e826)" + description = "Research Organisation Registry identifier of the organisation as full URL, using the HTTPS scheme and the ror.org domain (e.g. https://ror.org/051z6e826)" )] pub fn ror(&self) -> Option<&Ror> { self.ror.as_ref() @@ -3847,7 +3847,7 @@ impl Institution { } } -#[juniper::graphql_object(Context = Context, description = "A grant awarded to the publication of a work by an institution.")] +#[juniper::graphql_object(Context = Context, description = "A grant awarded for the publication of a work by an institution.")] impl Funding { #[graphql(description = "Thoth ID of the funding")] pub fn funding_id(&self) -> &Uuid { @@ -3879,12 +3879,12 @@ impl Funding { self.project_shortname.as_ref() } - #[graphql(description = "Grant number of the funding project")] + #[graphql(description = "Grant number of the award")] pub fn grant_number(&self) -> Option<&String> { self.grant_number.as_ref() } - #[graphql(description = "Jurisdiction of the funding project")] + #[graphql(description = "Jurisdiction of the award")] pub fn jurisdiction(&self) -> Option<&String> { self.jurisdiction.as_ref() } @@ -3969,12 +3969,12 @@ impl WorkRelation { &self.work_relation_id } - #[graphql(description = "Thoth ID of the relator work")] + #[graphql(description = "Thoth ID of the work to which this work relation belongs")] pub fn relator_work_id(&self) -> &Uuid { &self.relator_work_id } - #[graphql(description = "Thoth ID of the related work")] + #[graphql(description = "Thoth ID of the other work in the relationship")] pub fn related_work_id(&self) -> &Uuid { &self.related_work_id } @@ -4001,7 +4001,7 @@ impl WorkRelation { self.updated_at.clone() } - #[graphql(description = "Get the related work")] + #[graphql(description = "Get the other work in the relationship")] pub fn related_work(&self, context: &Context) -> FieldResult { Work::from_id(&context.db, &self.related_work_id).map_err(|e| e.into()) } diff --git a/thoth-api/src/graphql/utils.rs b/thoth-api/src/graphql/utils.rs index f6c227691..95440fea7 100644 --- a/thoth-api/src/graphql/utils.rs +++ b/thoth-api/src/graphql/utils.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use serde::Serialize; #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq, juniper::GraphQLEnum)] -#[graphql(description = "Order in which to sort query results (ascending or descending)")] +#[graphql(description = "Order in which to sort query results")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum Direction { #[cfg_attr(feature = "backend", graphql(description = "Ascending order"))] @@ -19,20 +19,22 @@ fn test_direction_default() { } #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq, juniper::GraphQLEnum)] -#[graphql( - description = "Expression to use when filtering by numeric value (greater than or less than)" -)] +#[graphql(description = "Expression to use when filtering by numeric value")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum Expression { #[cfg_attr( feature = "backend", - graphql(description = "Return only values which are greater than the one supplied") + graphql( + description = "Return only results with values which are greater than the value supplied" + ) )] #[default] GreaterThan, #[cfg_attr( feature = "backend", - graphql(description = "Return only values which are less than the one supplied") + graphql( + description = "Return only results with values which are less than the value supplied" + ) )] LessThan, } diff --git a/thoth-api/src/model/funding/mod.rs b/thoth-api/src/model/funding/mod.rs index 9494664e5..d976ecdf3 100644 --- a/thoth-api/src/model/funding/mod.rs +++ b/thoth-api/src/model/funding/mod.rs @@ -66,7 +66,7 @@ pub struct FundingWithWork { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, Insertable), - graphql(description = "Set of values required to define a new grant awarded to the publication of a work by an institution"), + graphql(description = "Set of values required to define a new grant awarded for the publication of a work by an institution"), diesel(table_name = funding) )] pub struct NewFunding { @@ -82,7 +82,7 @@ pub struct NewFunding { #[cfg_attr( feature = "backend", derive(juniper::GraphQLInputObject, AsChangeset), - graphql(description = "Set of values required to update an existing grant awarded to the publication of a work by an institution"), + graphql(description = "Set of values required to update an existing grant awarded for the publication of a work by an institution"), diesel(table_name = funding, treat_none_as_null = true) )] pub struct PatchFunding { diff --git a/thoth-api/src/model/language/mod.rs b/thoth-api/src/model/language/mod.rs index b4ad94e73..cea64f7af 100644 --- a/thoth-api/src/model/language/mod.rs +++ b/thoth-api/src/model/language/mod.rs @@ -13,7 +13,7 @@ use crate::schema::language_history; feature = "backend", derive(DbEnum, juniper::GraphQLEnum), graphql( - description = "Relation between a language listed for a work and the original language of a text" + description = "Relation between a language listed for a work and the original language of the work's text" ), ExistingTypePath = "crate::schema::sql_types::LanguageRelation" )] diff --git a/thoth-api/src/model/location/mod.rs b/thoth-api/src/model/location/mod.rs index c1cdba859..bdf894b79 100644 --- a/thoth-api/src/model/location/mod.rs +++ b/thoth-api/src/model/location/mod.rs @@ -13,7 +13,7 @@ use crate::schema::location_history; #[cfg_attr( feature = "backend", derive(DbEnum, juniper::GraphQLEnum), - graphql(description = "Platform on which a publication is hosted"), + graphql(description = "Platform where a publication is hosted or can be acquired"), ExistingTypePath = "crate::schema::sql_types::LocationPlatform" )] #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize, EnumString, Display)] @@ -138,7 +138,7 @@ pub enum LocationPlatform { #[cfg_attr( feature = "backend", db_rename = "Other", - graphql(description = "Another hosting platform not listed above") + graphql(description = "Another platform not listed above") )] #[default] Other, diff --git a/thoth-api/src/model/work_relation/mod.rs b/thoth-api/src/model/work_relation/mod.rs index ce17c0e64..5959c6c76 100644 --- a/thoth-api/src/model/work_relation/mod.rs +++ b/thoth-api/src/model/work_relation/mod.rs @@ -26,7 +26,7 @@ pub enum RelationType { #[cfg_attr( feature = "backend", graphql( - description = "The work to which this relation belongs replaces the work identified within the relation" + description = "The work to which this relation belongs replaces the other work in the relationship" ) )] Replaces, @@ -34,7 +34,7 @@ pub enum RelationType { feature = "backend", db_rename = "has-translation", graphql( - description = "The work to which this relation belongs is translated by the work identified within the relation" + description = "The work to which this relation belongs is translated by the other work in the relationship" ) )] HasTranslation, @@ -42,7 +42,7 @@ pub enum RelationType { feature = "backend", db_rename = "has-part", graphql( - description = "The work to which this relation belongs contains the work (part) identified within the relation" + description = "The work to which this relation belongs contains the other work (part) in the relationship" ) )] HasPart, @@ -50,7 +50,7 @@ pub enum RelationType { feature = "backend", db_rename = "has-child", graphql( - description = "The work to which this relation belongs contains the work (chapter) identified within the relation" + description = "The work to which this relation belongs contains the other work (chapter) in the relationship" ) )] #[default] @@ -59,7 +59,7 @@ pub enum RelationType { feature = "backend", db_rename = "is-replaced-by", graphql( - description = "The work to which this relation belongs is replaced by the work identified within the relation" + description = "The work to which this relation belongs is replaced by the other work in the relationship" ) )] IsReplacedBy, @@ -67,7 +67,7 @@ pub enum RelationType { feature = "backend", db_rename = "is-translation-of", graphql( - description = "The work to which this relation belongs is a translation of the work identified within the relation" + description = "The work to which this relation belongs is a translation of the other work in the relationship" ) )] IsTranslationOf, @@ -75,7 +75,7 @@ pub enum RelationType { feature = "backend", db_rename = "is-part-of", graphql( - description = "The work to which this relation belongs is a component (part) of the work identified within the relation" + description = "The work to which this relation belongs is a component (part) of the other work in the relationship" ) )] IsPartOf, @@ -83,7 +83,7 @@ pub enum RelationType { feature = "backend", db_rename = "is-child-of", graphql( - description = "The work to which this relation belongs is a component (chapter) of the work identified within the relation" + description = "The work to which this relation belongs is a component (chapter) of the other work in the relationship" ) )] IsChildOf,