Skip to content

Commit

Permalink
fix(dll): move introspection DLL exports to shared types header
Browse files Browse the repository at this point in the history
  • Loading branch information
wravery committed Sep 24, 2024
1 parent 68b9d33 commit 2dc6ebe
Show file tree
Hide file tree
Showing 15 changed files with 176 additions and 157 deletions.
33 changes: 3 additions & 30 deletions include/graphqlservice/introspection/IntrospectionSchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "graphqlservice/GraphQLResponse.h"
#include "graphqlservice/GraphQLService.h"

#include "graphqlservice/internal/DllExports.h"
#include "graphqlservice/internal/Version.h"
#include "graphqlservice/internal/Schema.h"

Expand All @@ -25,8 +26,7 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql {
namespace introspection {
namespace graphql::introspection {
class Schema;
class Type;
class Field;
Expand Down Expand Up @@ -54,33 +54,6 @@ void AddDirectiveDetails(const std::shared_ptr<schema::ObjectType>& typeDirectiv

GRAPHQLSERVICE_EXPORT void AddTypesToSchema(const std::shared_ptr<schema::Schema>& schema);

} // namespace introspection

namespace service {

#ifdef GRAPHQL_DLLEXPORTS
// Export all of the built-in converters
template <>
GRAPHQLSERVICE_EXPORT introspection::TypeKind Argument<introspection::TypeKind>::convert(
const response::Value& value);
template <>
GRAPHQLSERVICE_EXPORT AwaitableResolver Result<introspection::TypeKind>::convert(
AwaitableScalar<introspection::TypeKind> result, ResolverParams&& params);
template <>
GRAPHQLSERVICE_EXPORT void Result<introspection::TypeKind>::validateScalar(
const response::Value& value);
template <>
GRAPHQLSERVICE_EXPORT introspection::DirectiveLocation Argument<introspection::DirectiveLocation>::convert(
const response::Value& value);
template <>
GRAPHQLSERVICE_EXPORT AwaitableResolver Result<introspection::DirectiveLocation>::convert(
AwaitableScalar<introspection::DirectiveLocation> result, ResolverParams&& params);
template <>
GRAPHQLSERVICE_EXPORT void Result<introspection::DirectiveLocation>::validateScalar(
const response::Value& value);
#endif // GRAPHQL_DLLEXPORTS

} // namespace service
} // namespace graphql
} // namespace graphql::introspection

#endif // INTROSPECTIONSCHEMA_H
33 changes: 31 additions & 2 deletions include/graphqlservice/introspection/IntrospectionSharedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "graphqlservice/GraphQLResponse.h"

#include "graphqlservice/internal/DllExports.h"
#include "graphqlservice/internal/Version.h"

#include <array>
Expand All @@ -23,7 +24,8 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql::introspection {
namespace graphql {
namespace introspection {

enum class TypeKind
{
Expand Down Expand Up @@ -146,6 +148,33 @@ enum class DirectiveLocation
};
}

} // namespace graphql::introspection
} // namespace introspection

namespace service {

#ifdef GRAPHQL_DLLEXPORTS
// Export all of the built-in converters
template <>
GRAPHQLSERVICE_EXPORT introspection::TypeKind Argument<introspection::TypeKind>::convert(
const response::Value& value);
template <>
GRAPHQLSERVICE_EXPORT AwaitableResolver Result<introspection::TypeKind>::convert(
AwaitableScalar<introspection::TypeKind> result, ResolverParams&& params);
template <>
GRAPHQLSERVICE_EXPORT void Result<introspection::TypeKind>::validateScalar(
const response::Value& value);
template <>
GRAPHQLSERVICE_EXPORT introspection::DirectiveLocation Argument<introspection::DirectiveLocation>::convert(
const response::Value& value);
template <>
GRAPHQLSERVICE_EXPORT AwaitableResolver Result<introspection::DirectiveLocation>::convert(
AwaitableScalar<introspection::DirectiveLocation> result, ResolverParams&& params);
template <>
GRAPHQLSERVICE_EXPORT void Result<introspection::DirectiveLocation>::validateScalar(
const response::Value& value);
#endif // GRAPHQL_DLLEXPORTS

} // namespace service
} // namespace graphql

#endif // INTROSPECTIONSHAREDTYPES_H
6 changes: 2 additions & 4 deletions samples/learn/schema/StarWarsSchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql {
namespace learn {
namespace graphql::learn {
namespace object {

class Character;
Expand Down Expand Up @@ -73,7 +72,6 @@ void AddSubscriptionDetails(const std::shared_ptr<schema::ObjectType>& typeSubsc

std::shared_ptr<schema::Schema> GetSchema();

} // namespace learn
} // namespace graphql
} // namespace graphql::learn

#endif // STARWARSSCHEMA_H
6 changes: 4 additions & 2 deletions samples/learn/schema/StarWarsSharedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql::learn {
namespace graphql {
namespace learn {

enum class [[nodiscard("unnecessary conversion")]] Episode
{
Expand Down Expand Up @@ -71,6 +72,7 @@ struct [[nodiscard("unnecessary construction")]] ReviewInput
std::optional<std::string> commentary;
};

} // namespace graphql::learn
} // namespace learn
} // namespace graphql

#endif // STARWARSSHAREDTYPES_H
6 changes: 2 additions & 4 deletions samples/proxy/schema/ProxySchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql {
namespace proxy {
namespace graphql::proxy {
namespace object {

class Query;
Expand Down Expand Up @@ -57,7 +56,6 @@ void AddQueryResultsDetails(const std::shared_ptr<schema::ObjectType>& typeQuery

std::shared_ptr<schema::Schema> GetSchema();

} // namespace proxy
} // namespace graphql
} // namespace graphql::proxy

#endif // PROXYSCHEMA_H
6 changes: 4 additions & 2 deletions samples/proxy/schema/ProxySharedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql::proxy {
namespace graphql {
namespace proxy {

enum class [[nodiscard("unnecessary conversion")]] OperationType
{
Expand Down Expand Up @@ -75,6 +76,7 @@ struct [[nodiscard("unnecessary construction")]] QueryInput
std::optional<std::string> variables;
};

} // namespace graphql::proxy
} // namespace proxy
} // namespace graphql

#endif // PROXYSHAREDTYPES_H
6 changes: 2 additions & 4 deletions samples/today/nointrospection/TodaySchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql {
namespace today {
namespace graphql::today {
namespace object {

class Node;
Expand Down Expand Up @@ -97,7 +96,6 @@ void AddExpensiveDetails(const std::shared_ptr<schema::ObjectType>& typeExpensiv

std::shared_ptr<schema::Schema> GetSchema();

} // namespace today
} // namespace graphql
} // namespace graphql::today

#endif // TODAYSCHEMA_H
6 changes: 4 additions & 2 deletions samples/today/nointrospection/TodaySharedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql::today {
namespace graphql {
namespace today {

enum class [[nodiscard("unnecessary conversion")]] TaskState
{
Expand Down Expand Up @@ -232,6 +233,7 @@ struct [[nodiscard("unnecessary construction")]] FirstNestedInput
ThirdNestedInput third;
};

} // namespace graphql::today
} // namespace today
} // namespace graphql

#endif // TODAYSHAREDTYPES_H
6 changes: 2 additions & 4 deletions samples/today/schema/TodaySchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql {
namespace today {
namespace graphql::today {
namespace object {

class Node;
Expand Down Expand Up @@ -97,7 +96,6 @@ void AddExpensiveDetails(const std::shared_ptr<schema::ObjectType>& typeExpensiv

std::shared_ptr<schema::Schema> GetSchema();

} // namespace today
} // namespace graphql
} // namespace graphql::today

#endif // TODAYSCHEMA_H
6 changes: 4 additions & 2 deletions samples/today/schema/TodaySharedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql::today {
namespace graphql {
namespace today {

enum class [[nodiscard("unnecessary conversion")]] TaskState
{
Expand Down Expand Up @@ -232,6 +233,7 @@ struct [[nodiscard("unnecessary construction")]] FirstNestedInput
ThirdNestedInput third;
};

} // namespace graphql::today
} // namespace today
} // namespace graphql

#endif // TODAYSHAREDTYPES_H
6 changes: 2 additions & 4 deletions samples/validation/schema/ValidationSchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql {
namespace validation {
namespace graphql::validation {
namespace object {

class Sentient;
Expand Down Expand Up @@ -95,7 +94,6 @@ void AddArgumentsDetails(const std::shared_ptr<schema::ObjectType>& typeArgument

std::shared_ptr<schema::Schema> GetSchema();

} // namespace validation
} // namespace graphql
} // namespace graphql::validation

#endif // VALIDATIONSCHEMA_H
6 changes: 4 additions & 2 deletions samples/validation/schema/ValidationSharedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql::validation {
namespace graphql {
namespace validation {

enum class [[nodiscard("unnecessary conversion")]] DogCommand
{
Expand Down Expand Up @@ -94,6 +95,7 @@ struct [[nodiscard("unnecessary construction")]] ComplexInput
std::optional<std::string> owner;
};

} // namespace graphql::validation
} // namespace validation
} // namespace graphql

#endif // VALIDATIONSHAREDTYPES_H
Loading

0 comments on commit 2dc6ebe

Please sign in to comment.