Skip to content

fix: use file prefix in include guards and optionally in object filenames #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/SchemaGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct [[nodiscard("unnecessary construction")]] GeneratorOptions
const bool verbose = false;
const bool stubs = false;
const bool noIntrospection = false;
const bool prefixedHeaders = false;
};

class [[nodiscard("unnecessary construction")]] Generator
Expand Down
6 changes: 3 additions & 3 deletions include/graphqlservice/introspection/DirectiveObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef DIRECTIVEOBJECT_H
#define DIRECTIVEOBJECT_H
#ifndef INTROSPECTION_DIRECTIVEOBJECT_H
#define INTROSPECTION_DIRECTIVEOBJECT_H

#include "IntrospectionSchema.h"

Expand Down Expand Up @@ -85,4 +85,4 @@ class [[nodiscard("unnecessary construction")]] Directive final

} // namespace graphql::introspection::object

#endif // DIRECTIVEOBJECT_H
#endif // INTROSPECTION_DIRECTIVEOBJECT_H
6 changes: 3 additions & 3 deletions include/graphqlservice/introspection/EnumValueObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef ENUMVALUEOBJECT_H
#define ENUMVALUEOBJECT_H
#ifndef INTROSPECTION_ENUMVALUEOBJECT_H
#define INTROSPECTION_ENUMVALUEOBJECT_H

#include "IntrospectionSchema.h"

Expand Down Expand Up @@ -78,4 +78,4 @@ class [[nodiscard("unnecessary construction")]] EnumValue final

} // namespace graphql::introspection::object

#endif // ENUMVALUEOBJECT_H
#endif // INTROSPECTION_ENUMVALUEOBJECT_H
6 changes: 3 additions & 3 deletions include/graphqlservice/introspection/FieldObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef FIELDOBJECT_H
#define FIELDOBJECT_H
#ifndef INTROSPECTION_FIELDOBJECT_H
#define INTROSPECTION_FIELDOBJECT_H

#include "IntrospectionSchema.h"

Expand Down Expand Up @@ -92,4 +92,4 @@ class [[nodiscard("unnecessary construction")]] Field final

} // namespace graphql::introspection::object

#endif // FIELDOBJECT_H
#endif // INTROSPECTION_FIELDOBJECT_H
6 changes: 3 additions & 3 deletions include/graphqlservice/introspection/InputValueObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef INPUTVALUEOBJECT_H
#define INPUTVALUEOBJECT_H
#ifndef INTROSPECTION_INPUTVALUEOBJECT_H
#define INTROSPECTION_INPUTVALUEOBJECT_H

#include "IntrospectionSchema.h"

Expand Down Expand Up @@ -78,4 +78,4 @@ class [[nodiscard("unnecessary construction")]] InputValue final

} // namespace graphql::introspection::object

#endif // INPUTVALUEOBJECT_H
#endif // INTROSPECTION_INPUTVALUEOBJECT_H
6 changes: 3 additions & 3 deletions include/graphqlservice/introspection/SchemaObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef SCHEMAOBJECT_H
#define SCHEMAOBJECT_H
#ifndef INTROSPECTION_SCHEMAOBJECT_H
#define INTROSPECTION_SCHEMAOBJECT_H

#include "IntrospectionSchema.h"

Expand Down Expand Up @@ -92,4 +92,4 @@ class [[nodiscard("unnecessary construction")]] Schema final

} // namespace graphql::introspection::object

#endif // SCHEMAOBJECT_H
#endif // INTROSPECTION_SCHEMAOBJECT_H
6 changes: 3 additions & 3 deletions include/graphqlservice/introspection/TypeObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef TYPEOBJECT_H
#define TYPEOBJECT_H
#ifndef INTROSPECTION_TYPEOBJECT_H
#define INTROSPECTION_TYPEOBJECT_H

#include "IntrospectionSchema.h"

Expand Down Expand Up @@ -120,4 +120,4 @@ class [[nodiscard("unnecessary construction")]] Type final

} // namespace graphql::introspection::object

#endif // TYPEOBJECT_H
#endif // INTROSPECTION_TYPEOBJECT_H
6 changes: 3 additions & 3 deletions samples/learn/schema/CharacterObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef CHARACTEROBJECT_H
#define CHARACTEROBJECT_H
#ifndef STARWARS_CHARACTEROBJECT_H
#define STARWARS_CHARACTEROBJECT_H

#include "StarWarsSchema.h"

Expand Down Expand Up @@ -78,4 +78,4 @@ class [[nodiscard("unnecessary construction")]] Character final

} // namespace graphql::learn::object

#endif // CHARACTEROBJECT_H
#endif // STARWARS_CHARACTEROBJECT_H
6 changes: 3 additions & 3 deletions samples/learn/schema/DroidObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef DROIDOBJECT_H
#define DROIDOBJECT_H
#ifndef STARWARS_DROIDOBJECT_H
#define STARWARS_DROIDOBJECT_H

#include "StarWarsSchema.h"

Expand Down Expand Up @@ -248,4 +248,4 @@ class [[nodiscard("unnecessary construction")]] Droid final

} // namespace graphql::learn::object

#endif // DROIDOBJECT_H
#endif // STARWARS_DROIDOBJECT_H
6 changes: 3 additions & 3 deletions samples/learn/schema/HumanObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef HUMANOBJECT_H
#define HUMANOBJECT_H
#ifndef STARWARS_HUMANOBJECT_H
#define STARWARS_HUMANOBJECT_H

#include "StarWarsSchema.h"

Expand Down Expand Up @@ -248,4 +248,4 @@ class [[nodiscard("unnecessary construction")]] Human final

} // namespace graphql::learn::object

#endif // HUMANOBJECT_H
#endif // STARWARS_HUMANOBJECT_H
6 changes: 3 additions & 3 deletions samples/learn/schema/MutationObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef MUTATIONOBJECT_H
#define MUTATIONOBJECT_H
#ifndef STARWARS_MUTATIONOBJECT_H
#define STARWARS_MUTATIONOBJECT_H

#include "StarWarsSchema.h"

Expand Down Expand Up @@ -124,4 +124,4 @@ class [[nodiscard("unnecessary construction")]] Mutation final

} // namespace graphql::learn::object

#endif // MUTATIONOBJECT_H
#endif // STARWARS_MUTATIONOBJECT_H
6 changes: 3 additions & 3 deletions samples/learn/schema/QueryObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef QUERYOBJECT_H
#define QUERYOBJECT_H
#ifndef STARWARS_QUERYOBJECT_H
#define STARWARS_QUERYOBJECT_H

#include "StarWarsSchema.h"

Expand Down Expand Up @@ -182,4 +182,4 @@ class [[nodiscard("unnecessary construction")]] Query final

} // namespace graphql::learn::object

#endif // QUERYOBJECT_H
#endif // STARWARS_QUERYOBJECT_H
6 changes: 3 additions & 3 deletions samples/learn/schema/ReviewObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef REVIEWOBJECT_H
#define REVIEWOBJECT_H
#ifndef STARWARS_REVIEWOBJECT_H
#define STARWARS_REVIEWOBJECT_H

#include "StarWarsSchema.h"

Expand Down Expand Up @@ -151,4 +151,4 @@ class [[nodiscard("unnecessary construction")]] Review final

} // namespace graphql::learn::object

#endif // REVIEWOBJECT_H
#endif // STARWARS_REVIEWOBJECT_H
6 changes: 3 additions & 3 deletions samples/learn/schema/SubscriptionObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef SUBSCRIPTIONOBJECT_H
#define SUBSCRIPTIONOBJECT_H
#ifndef STARWARS_SUBSCRIPTIONOBJECT_H
#define STARWARS_SUBSCRIPTIONOBJECT_H

#include "StarWarsSchema.h"

Expand Down Expand Up @@ -161,4 +161,4 @@ class [[nodiscard("unnecessary construction")]] Subscription final

} // namespace graphql::learn::object

#endif // SUBSCRIPTIONOBJECT_H
#endif // STARWARS_SUBSCRIPTIONOBJECT_H
6 changes: 3 additions & 3 deletions samples/proxy/schema/QueryObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef QUERYOBJECT_H
#define QUERYOBJECT_H
#ifndef PROXY_QUERYOBJECT_H
#define PROXY_QUERYOBJECT_H

#include "ProxySchema.h"

Expand Down Expand Up @@ -128,4 +128,4 @@ class [[nodiscard("unnecessary construction")]] Query final

} // namespace graphql::proxy::object

#endif // QUERYOBJECT_H
#endif // PROXY_QUERYOBJECT_H
6 changes: 3 additions & 3 deletions samples/proxy/schema/QueryResultsObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#pragma once

#ifndef QUERYRESULTSOBJECT_H
#define QUERYRESULTSOBJECT_H
#ifndef PROXY_QUERYRESULTSOBJECT_H
#define PROXY_QUERYRESULTSOBJECT_H

#include "ProxySchema.h"

Expand Down Expand Up @@ -151,4 +151,4 @@ class [[nodiscard("unnecessary construction")]] QueryResults final

} // namespace graphql::proxy::object

#endif // QUERYRESULTSOBJECT_H
#endif // PROXY_QUERYRESULTSOBJECT_H
4 changes: 1 addition & 3 deletions samples/stitched/StitchedSchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#include "StitchedSchema.h"

#include "StarWarsData.h"
#include "StarWarsSchema.h"

import GraphQL.Today.Mock;
#include "TodayMock.h"

namespace graphql::stitched {

Expand Down
14 changes: 7 additions & 7 deletions samples/today/TodayMock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

#include "TodayMock.h"

#include "AppointmentConnectionObject.h"
#include "CompleteTaskPayloadObject.h"
#include "ExpensiveObject.h"
#include "FolderConnectionObject.h"
#include "NestedTypeObject.h"
#include "TaskConnectionObject.h"
#include "UnionTypeObject.h"
#include "TodayAppointmentConnectionObject.h"
#include "TodayCompleteTaskPayloadObject.h"
#include "TodayExpensiveObject.h"
#include "TodayFolderConnectionObject.h"
#include "TodayNestedTypeObject.h"
#include "TodayTaskConnectionObject.h"
#include "TodayUnionTypeObject.h"

#include <algorithm>
#include <chrono>
Expand Down
22 changes: 11 additions & 11 deletions samples/today/TodayMock.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@

#include "TodaySchema.h"

#include "AppointmentEdgeObject.h"
#include "AppointmentObject.h"
#include "FolderEdgeObject.h"
#include "FolderObject.h"
#include "MutationObject.h"
#include "NodeObject.h"
#include "PageInfoObject.h"
#include "QueryObject.h"
#include "SubscriptionObject.h"
#include "TaskEdgeObject.h"
#include "TaskObject.h"
#include "TodayAppointmentEdgeObject.h"
#include "TodayAppointmentObject.h"
#include "TodayFolderEdgeObject.h"
#include "TodayFolderObject.h"
#include "TodayMutationObject.h"
#include "TodayNodeObject.h"
#include "TodayPageInfoObject.h"
#include "TodayQueryObject.h"
#include "TodaySubscriptionObject.h"
#include "TodayTaskEdgeObject.h"
#include "TodayTaskObject.h"

#include <atomic>
#include <memory>
Expand Down
6 changes: 3 additions & 3 deletions samples/today/nointrospection/AppointmentConnectionObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

// WARNING! Do not edit this file manually, your changes will be overwritten.

#include "AppointmentConnectionObject.h"
#include "PageInfoObject.h"
#include "AppointmentEdgeObject.h"
#include "TodayAppointmentConnectionObject.h"
#include "TodayPageInfoObject.h"
#include "TodayAppointmentEdgeObject.h"

#include "graphqlservice/internal/Schema.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

module;

#include "AppointmentConnectionObject.h"
#include "TodayAppointmentConnectionObject.h"

export module GraphQL.Today.AppointmentConnectionObject;

Expand Down
4 changes: 2 additions & 2 deletions samples/today/nointrospection/AppointmentEdgeObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

// WARNING! Do not edit this file manually, your changes will be overwritten.

#include "AppointmentEdgeObject.h"
#include "AppointmentObject.h"
#include "TodayAppointmentEdgeObject.h"
#include "TodayAppointmentObject.h"

#include "graphqlservice/internal/Schema.h"

Expand Down
2 changes: 1 addition & 1 deletion samples/today/nointrospection/AppointmentEdgeObject.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

module;

#include "AppointmentEdgeObject.h"
#include "TodayAppointmentEdgeObject.h"

export module GraphQL.Today.AppointmentEdgeObject;

Expand Down
2 changes: 1 addition & 1 deletion samples/today/nointrospection/AppointmentObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// WARNING! Do not edit this file manually, your changes will be overwritten.

#include "AppointmentObject.h"
#include "TodayAppointmentObject.h"

#include "graphqlservice/internal/Schema.h"

Expand Down
2 changes: 1 addition & 1 deletion samples/today/nointrospection/AppointmentObject.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

module;

#include "AppointmentObject.h"
#include "TodayAppointmentObject.h"

export module GraphQL.Today.AppointmentObject;

Expand Down
2 changes: 1 addition & 1 deletion samples/today/nointrospection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.28)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/cppgraphqlgen-functions.cmake)

if(GRAPHQL_UPDATE_SAMPLES)
update_graphql_schema_files(today_nointrospection ../schema.today.graphql Today today --stubs --no-introspection)
update_graphql_schema_files(today_nointrospection ../schema.today.graphql Today today --stubs --no-introspection --prefix-headers)
endif()

add_graphql_schema_target(today_nointrospection)
Loading