Skip to content

Commit a377114

Browse files
committed
Fix schema description
1 parent 2344b35 commit a377114

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

samples/today/nointrospection/TodaySchema.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void AddTypesToSchema(const std::shared_ptr<schema::Schema>& schema)
267267
introspection::DirectiveLocation::SUBSCRIPTION
268268
}, {
269269
schema::InputValue::Make(R"gql(field)gql"sv, R"md()md"sv, schema->LookupType(R"gql(String)gql"sv), R"gql()gql"sv)
270-
}, false));
270+
}, true));
271271
schema->AddDirective(schema::Directive::Make(R"gql(queryTag)gql"sv, R"md()md"sv, {
272272
introspection::DirectiveLocation::QUERY
273273
}, {

samples/today/schema.today.graphql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4+
"Test Schema based on a dashboard showing daily appointments, tasks, and email folders with unread counts."
45
schema {
56
query: Query
67
mutation: Mutation
@@ -102,9 +103,9 @@ type Subscription {
102103
nodeChange(id: ID!): Node!
103104
}
104105

105-
directive @subscriptionTag(field: String) on SUBSCRIPTION
106+
directive @subscriptionTag(field: String) repeatable on SUBSCRIPTION
106107

107-
scalar DateTime
108+
scalar DateTime @specifiedBy(url: "https://en.wikipedia.org/wiki/ISO_8601")
108109

109110
enum TaskState {
110111
New

samples/today/schema/TodaySchema.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Operations::Operations(std::shared_ptr<object::Query> query, std::shared_ptr<obj
160160
void AddTypesToSchema(const std::shared_ptr<schema::Schema>& schema)
161161
{
162162
schema->AddType(R"gql(ItemCursor)gql"sv, schema::ScalarType::Make(R"gql(ItemCursor)gql"sv, R"md()md", R"url()url"sv));
163-
schema->AddType(R"gql(DateTime)gql"sv, schema::ScalarType::Make(R"gql(DateTime)gql"sv, R"md()md", R"url()url"sv));
163+
schema->AddType(R"gql(DateTime)gql"sv, schema::ScalarType::Make(R"gql(DateTime)gql"sv, R"md()md", R"url(https://en.wikipedia.org/wiki/ISO_8601)url"sv));
164164
auto typeTaskState = schema::EnumType::Make(R"gql(TaskState)gql"sv, R"md()md"sv);
165165
schema->AddType(R"gql(TaskState)gql"sv, typeTaskState);
166166
auto typeCompleteTaskInput = schema::InputObjectType::Make(R"gql(CompleteTaskInput)gql"sv, R"md()md"sv);
@@ -267,7 +267,7 @@ void AddTypesToSchema(const std::shared_ptr<schema::Schema>& schema)
267267
introspection::DirectiveLocation::SUBSCRIPTION
268268
}, {
269269
schema::InputValue::Make(R"gql(field)gql"sv, R"md()md"sv, schema->LookupType(R"gql(String)gql"sv), R"gql()gql"sv)
270-
}, false));
270+
}, true));
271271
schema->AddDirective(schema::Directive::Make(R"gql(queryTag)gql"sv, R"md()md"sv, {
272272
introspection::DirectiveLocation::QUERY
273273
}, {
@@ -306,7 +306,7 @@ std::shared_ptr<schema::Schema> GetSchema()
306306

307307
if (!schema)
308308
{
309-
schema = std::make_shared<schema::Schema>(false, R"md()md"sv);
309+
schema = std::make_shared<schema::Schema>(false, R"md(Test Schema based on a dashboard showing daily appointments, tasks, and email folders with unread counts.)md"sv);
310310
introspection::AddTypesToSchema(schema);
311311
AddTypesToSchema(schema);
312312
s_wpSchema = schema;

src/SchemaGenerator.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,14 @@ Operations::Operations()cpp";
17711771
{
17721772
schema = std::make_shared<schema::Schema>()cpp"
17731773
<< (_options.noIntrospection ? R"cpp(true)cpp" : R"cpp(false)cpp")
1774-
<< R"cpp(, R"md()cpp" << _loader.getSchemaDescription() << R"cpp()md"sv);
1774+
<< R"cpp(, R"md()cpp";
1775+
1776+
if (!_options.noIntrospection)
1777+
{
1778+
sourceFile << _loader.getSchemaDescription();
1779+
}
1780+
1781+
sourceFile << R"cpp()md"sv);
17751782
)cpp" << SchemaLoader::getIntrospectionNamespace()
17761783
<< R"cpp(::AddTypesToSchema(schema);
17771784
AddTypesToSchema(schema);

src/SchemaLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ void SchemaLoader::visitSchemaDefinition(const peg::ast_node& schemaDefinition)
515515
}
516516
});
517517

518-
if (!_schemaDescription.empty())
518+
if (_schemaDescription.empty())
519519
{
520520
_schemaDescription = description;
521521
}

0 commit comments

Comments
 (0)