Projects STRLCPY graphql-engine Commits e6829651
🤬
  • Default reason for field deprecation (#448)

    Generate default `deprecationReason` in GraphQL schema for OpenDd
    metadata marked as deprecated without a reason.
    
    V3_GIT_ORIGIN_REV_ID: 6979bd264b5c11d24b6c634115b6fbd8405a5ba6
  • Loading...
  • Rakesh Emmadi committed with hasura-bot 1 month ago
    e6829651
    1 parent 3e0fcba4
  • ■ ■ ■ ■ ■
    v3/crates/engine/src/schema.rs
    skipped 310 lines
    311 311  ) -> gql_schema::DeprecationStatus {
    312 312   match deprecated {
    313 313   Some(Deprecated { reason }) => gql_schema::DeprecationStatus::Deprecated {
    314  - reason: reason.clone(),
     314 + reason: Some(
     315 + reason
     316 + .as_ref()
     317 + // Use @deprecated built-in directive default reason.
     318 + // Ref: https://spec.graphql.org/October2021/#sec--deprecated
     319 + .map_or_else(|| "No longer supported".to_owned(), |s| s.clone()),
     320 + ),
    315 321   },
    316 322   None => gql_schema::DeprecationStatus::NotDeprecated,
    317 323   }
    skipped 2 lines
  • ■ ■ ■ ■ ■ ■
    v3/crates/engine/tests/execute/deprecated/introspection_expected.json
    skipped 56 lines
    57 57   {
    58 58   "name": "author_id",
    59 59   "isDeprecated": true,
    60  - "deprecationReason": null
     60 + "deprecationReason": "No longer supported"
    61 61   },
    62 62   {
    63 63   "name": "first_name",
    skipped 65 lines
    129 129   {
    130 130   "name": "AuthorMany",
    131 131   "isDeprecated": true,
    132  - "deprecationReason": null
     132 + "deprecationReason": "No longer supported"
    133 133   },
    134 134   {
    135 135   "name": "getActorsByNameOpaqueSurname",
    skipped 284 lines
    420 420   {
    421 421   "name": "author_id",
    422 422   "isDeprecated": true,
    423  - "deprecationReason": null
     423 + "deprecationReason": "No longer supported"
    424 424   },
    425 425   {
    426 426   "name": "first_name",
    skipped 55 lines
    482 482   {
    483 483   "name": "AuthorMany",
    484 484   "isDeprecated": true,
    485  - "deprecationReason": null
     485 + "deprecationReason": "No longer supported"
    486 486   }
    487 487   ]
    488 488   },
    skipped 241 lines
Please wait...
Page is in error, reload to recover