Skip to content
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

chore(2649): drop tag from config #2650

Merged
merged 7 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
11 changes: 0 additions & 11 deletions generated/.tailcallrc.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,6 @@ directive @server(
workers: Int
) on SCHEMA

"""
Used to represent an identifier for a type. Typically used via only by the configuration
generators to provide additional information about the type.
"""
directive @tag(
"""
A unique identifier for the type.
"""
id: String!
) on OBJECT

"""
The @telemetry directive facilitates seamless integration with OpenTelemetry, enhancing
the observability of your GraphQL services powered by Tailcall. By leveraging this
Expand Down
25 changes: 0 additions & 25 deletions generated/.tailcallrc.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1145,20 +1145,6 @@
}
}
},
"Tag": {
"description": "Used to represent an identifier for a type. Typically used via only by the configuration generators to provide additional information about the type.",
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"description": "A unique identifier for the type.",
"type": "string"
}
},
"additionalProperties": false
},
"Telemetry": {
"description": "The @telemetry directive facilitates seamless integration with OpenTelemetry, enhancing the observability of your GraphQL services powered by Tailcall. By leveraging this directive, developers gain access to valuable insights into the performance and behavior of their applications.",
"type": "object",
Expand Down Expand Up @@ -1293,17 +1279,6 @@
"type": "null"
}
]
},
"tag": {
"description": "Contains source information for the type.",
"anyOf": [
{
"$ref": "#/definitions/Tag"
},
{
"type": "null"
}
]
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") {
query: Query
}

input Id @tag(id: "news.NewsId") {
input Id {
id: Int
}

input news__MultipleNewsId @tag(id: "news.MultipleNewsId") {
input news__MultipleNewsId {
ids: [Id]
}

input news__NewsInput @tag(id: "news.News") {
input news__NewsInput {
body: String
id: Int
postImage: String
Expand Down Expand Up @@ -47,15 +47,15 @@ type Geo {
lng: String
}

type News @tag(id: "news.News") {
type News {
body: String
id: Int
postImage: String
status: news__Status
title: String
}

type NewsNewsServiceGetMultipleNew @tag(id: "news.NewsList") {
type NewsNewsServiceGetMultipleNew {
news: [News]
}

Expand Down
26 changes: 0 additions & 26 deletions src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ pub struct Type {
/// Marks field as protected by auth providers
#[serde(default)]
pub protected: Option<Protected>,
#[serde(default, skip_serializing_if = "is_default")]
///
/// Contains source information for the type.
pub tag: Option<Tag>,
}

impl Display for Type {
Expand Down Expand Up @@ -145,27 +141,6 @@ impl Type {
}
}

#[derive(
Clone,
Debug,
Default,
PartialEq,
Deserialize,
Serialize,
Eq,
schemars::JsonSchema,
MergeRight,
DirectiveDefinition,
)]
#[directive_definition(locations = "Object")]
#[serde(deny_unknown_fields)]
/// Used to represent an identifier for a type. Typically used via only by the
/// configuration generators to provide additional information about the type.
pub struct Tag {
/// A unique identifier for the type.
pub id: String,
}

#[derive(
Clone,
Debug,
Expand Down Expand Up @@ -1050,7 +1025,6 @@ impl Config {
.add_directive(Omit::directive_definition(generated_types))
.add_directive(Protected::directive_definition(generated_types))
.add_directive(Server::directive_definition(generated_types))
.add_directive(Tag::directive_definition(generated_types))
.add_directive(Telemetry::directive_definition(generated_types))
.add_directive(Upstream::directive_definition(generated_types))
.add_input(GraphQL::input_definition())
Expand Down
7 changes: 3 additions & 4 deletions src/core/config/from_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use async_graphql::Name;
use async_graphql_value::ConstValue;

use super::telemetry::Telemetry;
use super::{Alias, Tag, JS};
use super::{Alias, JS};
use crate::core::config::{
self, Cache, Call, Config, Enum, GraphQL, Grpc, Link, Modify, Omit, Protected, RootSchema,
Server, Union, Upstream, Variant,
Expand Down Expand Up @@ -242,12 +242,11 @@ where
Cache::from_directives(directives.iter())
.fuse(to_fields(fields))
.fuse(Protected::from_directives(directives.iter()))
.fuse(Tag::from_directives(directives.iter()))
.map(|(cache, fields, protected, tag)| {
.map(|(cache, fields, protected)| {
let doc = description.to_owned().map(|pos| pos.node);
let implements = implements.iter().map(|pos| pos.node.to_string()).collect();
let added_fields = to_add_fields_from_directives(directives);
config::Type { fields, added_fields, doc, implements, cache, protected, tag }
config::Type { fields, added_fields, doc, implements, cache, protected }
})
}
fn to_input_object(
Expand Down
1 change: 0 additions & 1 deletion src/core/config/into_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ fn config_document(config: &Config) -> ServiceDocument {
.as_ref()
.map(|protected| pos(protected.to_directive())),
)
.chain(type_def.tag.as_ref().map(|tag| pos(tag.to_directive())))
.collect::<Vec<_>>(),
kind,
})));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ schema @server @upstream {
query: Query
}

input news__MultipleNewsId @tag(id: "news.MultipleNewsId") {
input news__MultipleNewsId {
ids: [news__NewsId]
}

input news__NewsId @tag(id: "news.NewsId") {
input news__NewsId {
id: Int
}

input news__NewsInput @tag(id: "news.News") {
input news__NewsInput {
body: String
id: Int
postImage: String
Expand All @@ -37,14 +37,14 @@ type Query {
news__NewsService__GetNews(newsId: news__NewsId!): news__News! @grpc(body: "{{.args.newsId}}", method: "news.NewsService.GetNews")
}

type news__News @tag(id: "news.News") {
type news__News {
body: String
id: Int
postImage: String
status: news__Status
title: String
}

type news__NewsList @tag(id: "news.NewsList") {
type news__NewsList {
news: [news__News]
}
4 changes: 1 addition & 3 deletions src/core/generator/from_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use super::proto::comments_builder::CommentsBuilder;
use super::proto::path_builder::PathBuilder;
use super::proto::path_field::PathField;
use crate::core::config::transformer::{AmbiguousType, TreeShake};
use crate::core::config::{Arg, Config, Enum, Field, Grpc, Tag, Type, Union, Variant};
use crate::core::config::{Arg, Config, Enum, Field, Grpc, Type, Union, Variant};
use crate::core::transform::{Transform, TransformerOps};
use crate::core::valid::Validator;

Expand Down Expand Up @@ -308,8 +308,6 @@ impl Context {
}
}

ty.tag = Some(Tag { id: msg_type.id() });
tusharmath marked this conversation as resolved.
Show resolved Hide resolved

if message.oneof_decl.is_empty() {
self = self.insert_type(msg_type.to_string(), ty);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ schema @server @upstream {
query: Query
}

input greetings__HelloRequest @tag(id: "greetings.HelloRequest") {
input greetings__HelloRequest {
name: String
}

"""
The request message containing the user's name.
"""
input greetings_a__b__HelloRequest @tag(id: "greetings_a.b.HelloRequest") {
input greetings_a__b__HelloRequest {
name: String
}

input news__MultipleNewsId @tag(id: "news.MultipleNewsId") {
input news__MultipleNewsId {
ids: [news__NewsId]
}

input news__NewsId @tag(id: "news.NewsId") {
input news__NewsId {
id: Int
}

input news__NewsInput @tag(id: "news.News") {
input news__NewsInput {
body: String
id: Int
postImage: String
Expand Down Expand Up @@ -56,25 +56,25 @@ type Query {
news__NewsService__GetNews(newsId: news__NewsId!): news__News! @grpc(body: "{{.args.newsId}}", method: "news.NewsService.GetNews")
}

type greetings__HelloReply @tag(id: "greetings.HelloReply") {
type greetings__HelloReply {
message: String
}

"""
The response message containing the greetings
"""
type greetings_a__b__HelloReply @tag(id: "greetings_a.b.HelloReply") {
type greetings_a__b__HelloReply {
message: String
}

type news__News @tag(id: "news.News") {
type news__News {
body: String
id: Int
postImage: String
status: news__Status
title: String
}

type news__NewsList @tag(id: "news.NewsList") {
type news__NewsList {
news: [news__News]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ schema @server @upstream {
query: Query
}

type News @tag(id: "News") {
type News {
body: String
id: Int
postImage: String
title: String
}

type NewsList @tag(id: "NewsList") {
type NewsList {
news: [News]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ schema @server @upstream {
query: Query
}

input greetings__HelloRequest @tag(id: "greetings.HelloRequest") {
input greetings__HelloRequest {
name: String
}

type Query {
greetings__Greeter__SayHello(helloRequest: greetings__HelloRequest!): greetings__HelloReply! @grpc(body: "{{.args.helloRequest}}", method: "greetings.Greeter.SayHello")
}

type greetings__HelloReply @tag(id: "greetings.HelloReply") {
type greetings__HelloReply {
message: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ schema @server @upstream {
query: Query
}

input map__MapRequest @tag(id: "map.MapRequest") {
input map__MapRequest {
map: JSON
}

type Query {
map__MapService__GetMap(mapRequest: map__MapRequest!): map__MapResponse! @grpc(body: "{{.args.mapRequest}}", method: "map.MapService.GetMap")
}

type map__MapResponse @tag(id: "map.MapResponse") {
type map__MapResponse {
map: JSON
}
Loading
Loading