{"record":{"id":"58b57f32c20a25eb","repo":"hasura/graphql-engine","slug":"the-orderbyinput-enumtypenames-needs-to-be-defined","errorCode":null,"errorMessage":"the orderByInput.enumTypeNames needs to be defined in GraphqlConfig, when models have orderByExpressionType","messagePattern":"the orderByInput\\.enumTypeNames needs to be defined in GraphqlConfig, when models have orderByExpressionType","errorType":"validation","errorClass":"GraphqlConfigError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/graphql_config/error.rs","lineNumber":27,"sourceCode":"    #[error(\"graphql configuration should be defined only once in supergraph\")]\n    MultipleGraphqlConfigDefinition,\n    #[error(\n        \"the fieldName for limitInput needs to be defined in GraphqlConfig, when models have a selectMany graphql API\"\n    )]\n    MissingLimitFieldInGraphqlConfig,\n    #[error(\n        \"the fieldName for offsetInput needs to be defined in GraphqlConfig, when models have a selectMany graphql API\"\n    )]\n    MissingOffsetFieldInGraphqlConfig,\n    #[error(\n        \"the filterInput needs to be defined in GraphqlConfig, when models have filterExpressionType\"\n    )]\n    MissingFilterInputFieldInGraphqlConfig,\n    #[error(\n        \"the orderByInput needs to be defined in GraphqlConfig, when models have orderByExpressionType\"\n    )]\n    MissingOrderByInputFieldInGraphqlConfig,\n    #[error(\n        \"the orderByInput.enumTypeNames needs to be defined in GraphqlConfig, when models have orderByExpressionType\"\n    )]\n    MissingOrderByEnumTypeNamesInGraphqlConfig,\n    #[error(\n        \"only one enumTypeNames can be defined in GraphqlConfig, whose direction values are both 'asc' and 'desc'.\"\n    )]\n    MultipleOrderByEnumTypeNamesInGraphqlConfig,\n    #[error(\n        \"invalid directions: {directions} defined in orderByInput of GraphqlConfig , currently there is no support for partial directions. Please specify a type which has both 'asc' and 'desc' directions\"\n    )]\n    InvalidOrderByDirection { directions: String },\n    #[error(\n        \"the fieldName for argumentsInput needs to be defined in GraphqlConfig, when models have argumentsInputType\"\n    )]\n    MissingArgumentsInputFieldInGraphqlConfig,\n    #[error(\n        \"the filterInputFieldName for aggregate needs to be defined in GraphqlConfig, when models have a selectAggregate graphql API\"\n    )]","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/graphql_config/error.rs#L9-L45","documentation":"Raised when models use `orderByExpressionType` and GraphqlConfig defines `orderByInput` but omits `enumTypeNames`. The direction enum type names (asc/desc) are required to generate the orderBy input's enum values in the schema. Thrown by the graphql_config resolution stage.","triggerScenarios":"GraphqlConfig has an orderByInput without an enumTypeNames list while any model declares orderByExpressionType; metadata resolution fails.","commonSituations":"Authoring orderByInput partially (fieldName only); upgrading metadata from a version that auto-derived enum type names; following outdated docs that omit enumTypeNames.","solutions":["Add `enumTypeNames` to the orderByInput in GraphqlConfig, e.g. one entry with both 'asc' and 'desc' directions","Ensure the referenced enum type exists/should be generated in the schema","Regenerate metadata with current tooling"],"exampleFix":"// before\n{\"orderByInput\": {\"fieldName\": \"order_by\"}}\n// after\n{\"orderByInput\": {\"fieldName\": \"order_by\", \"enumTypeNames\": [{\"name\": \"OrderByDirection\", \"directions\": {\"asc\": \"asc\", \"desc\": \"desc\"}}]}}","handlingStrategy":"validation","validationCode":"if let Some(order_by) = &config.order_by_input {\n    assert!(!order_by.enum_type_names.is_empty(),\n        \"orderByInput.enumTypeNames is required when orderBy is used\");\n}","typeGuard":"fn enum_type_names_ok(config: &GraphqlConfig, needs: bool) -> bool {\n    !needs || config.order_by_input.as_ref().is_some_and(|o| !o.enum_type_names.is_empty())\n}","tryCatchPattern":"Err(GraphqlConfigError::MissingOrderByEnumTypeNamesInGraphqlConfig) => { /* add enumTypeNames with asc+desc and re-resolve */ }","preventionTips":["Always author orderByInput with both fieldName and enumTypeNames","Use a linter/JSON schema for metadata files","Validate before resolve"],"tags":["graphql","metadata","orderby","enum","validation"],"backgroundTag":"missing-graphql-config-field","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}