Commit 6831b25c authored by Brett Walker's avatar Brett Walker

Consider flags enabled when generating GraphQL schema

Turn all feature flags on when generating GraphQL
schema. Prevent pipeline failures in case developer
generate schema with flags on before pushing.
Ensures that fields controlled by a feature flag are output.
parent 86509ce3
......@@ -4987,6 +4987,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "descendantWeightSum",
"description": "Total weight of open and closed issues in the epic and its descendants. Available only when feature flag `unfiltered_epic_aggregates` is enabled.",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "EpicDescendantWeights",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "description",
"description": "Description of the epic",
......@@ -9737,6 +9751,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "healthStatus",
"description": "Current health status. Available only when feature flag `save_issuable_health_status` is enabled.",
"args": [
],
"type": {
"kind": "ENUM",
"name": "HealthStatus",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "id",
"description": "Global ID of the epic-issue relation",
......@@ -11117,6 +11145,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "healthStatus",
"description": "Current health status. Available only when feature flag `save_issuable_health_status` is enabled.",
"args": [
],
"type": {
"kind": "ENUM",
"name": "HealthStatus",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "iid",
"description": "Internal ID of the issue",
......@@ -13098,6 +13140,47 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "EpicDescendantWeights",
"description": "Total weight of open and closed descendant issues",
"fields": [
{
"name": "closedIssues",
"description": "Total weight of completed (closed) issues in this epic, including epic descendants",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "openedIssues",
"description": "Total weight of opened issues in this epic, including epic descendants",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "EpicHealthStatus",
......
......@@ -8,13 +8,14 @@ namespace :gitlab do
OUTPUT_DIR = Rails.root.join("doc/api/graphql/reference")
TEMPLATES_DIR = 'lib/gitlab/graphql/docs/templates/'
# Consider all feature flags disabled
# to avoid pipeline failures in case developer
# dumps schema with flags enabled locally before pushing
task disable_feature_flags: :environment do
# Make all feature flags enabled so that all feature flag
# controlled fields are considered visible and are output.
# Also avoids pipeline failures in case developer
# dumps schema with flags disabled locally before pushing
task enable_feature_flags: :environment do
class Feature
def self.enabled?(*args)
false
true
end
end
end
......@@ -25,7 +26,7 @@ namespace :gitlab do
# - gitlab:graphql:schema:json
GraphQL::RakeTask.new(
schema_name: 'GitlabSchema',
dependencies: [:environment, :disable_feature_flags],
dependencies: [:environment, :enable_feature_flags],
directory: OUTPUT_DIR,
idl_outfile: "gitlab_schema.graphql",
json_outfile: "gitlab_schema.json"
......@@ -33,7 +34,7 @@ namespace :gitlab do
namespace :graphql do
desc 'GitLab | GraphQL | Generate GraphQL docs'
task compile_docs: :environment do
task compile_docs: [:environment, :enable_feature_flags] do
renderer = Gitlab::Graphql::Docs::Renderer.new(GitlabSchema.graphql_definition, render_options)
renderer.write
......@@ -42,7 +43,7 @@ namespace :gitlab do
end
desc 'GitLab | GraphQL | Check if GraphQL docs are up to date'
task check_docs: :environment do
task check_docs: [:environment, :enable_feature_flags] do
renderer = Gitlab::Graphql::Docs::Renderer.new(GitlabSchema.graphql_definition, render_options)
doc = File.read(Rails.root.join(OUTPUT_DIR, 'index.md'))
......@@ -56,7 +57,7 @@ namespace :gitlab do
end
desc 'GitLab | GraphQL | Check if GraphQL schemas are up to date'
task check_schema: :environment do
task check_schema: [:environment, :enable_feature_flags] do
idl_doc = File.read(Rails.root.join(OUTPUT_DIR, 'gitlab_schema.graphql'))
json_doc = File.read(Rails.root.join(OUTPUT_DIR, 'gitlab_schema.json'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment