Skip to content

Commit 93b5711

Browse files
committed
format __typename
1 parent 695e3a1 commit 93b5711

File tree

15 files changed

+24
-36
lines changed

15 files changed

+24
-36
lines changed

crates/artifact_content/src/raw_response_type.rs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use intern::Lookup;
22
use isograph_lang_types::TypeAnnotation;
33
use isograph_schema::{
44
IsographDatabase, MergedSelectionMap, MergedServerSelection, NetworkProtocol,
5-
TYPENAME_FIELD_NAME, server_scalar_entity_javascript_name, server_scalar_selectable_named,
5+
server_scalar_entity_javascript_name, server_scalar_selectable_named,
66
};
77
use std::collections::BTreeMap;
88

@@ -56,23 +56,11 @@ pub fn generate_raw_response_type_inner<TNetworkProtocol: NetworkProtocol>(
5656
"Expected validation to have succeeded. \
5757
This is indicative of a bug in Isograph.",
5858
)
59-
.as_ref();
60-
61-
let server_scalar_selectable = match server_scalar_selectable {
62-
Some(server_scalar_selectable) => server_scalar_selectable,
63-
None => {
64-
if scalar_field.name == *TYPENAME_FIELD_NAME {
65-
// this might be __typename defined on an interface, this currently not supported,
66-
// we use a work around here
67-
raw_response_type_inner.push_str(&format!("{name}: string,\n",));
68-
continue;
69-
}
70-
panic!(
71-
"Expected selectable to exist. \
72-
This is indicative of a bug in Isograph.",
73-
);
74-
}
75-
};
59+
.as_ref()
60+
.expect(
61+
"Expected selectable to exist. \
62+
This is indicative of a bug in Isograph.",
63+
);
7664

7765
let raw_type = server_scalar_selectable.target_scalar_entity.as_ref().map(
7866
&mut |scalar_entity_name| match server_scalar_selectable

crates/graphql_network_protocol/src/process_type_system_definition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ fn process_object_type_definition(
415415
)),
416416
// This is bad data modeling, and we should do better.
417417
javascript_type_override: concrete_type.map(|parent_concrete_type| {
418-
format!("'{parent_concrete_type}'").intern().into()
418+
format!("\"{parent_concrete_type}\"").intern().into()
419419
}),
420420

421421
arguments: vec![],

demos/github-demo/src/isograph-components/__isograph/Query/RepositoryPage/raw_response_type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export type Query__RepositoryPage__rawResponse = {
1717
node: {
1818
id: string,
1919
author: {
20-
__typename: 'User',
20+
__typename: "User",
2121
id: string,
2222
login: string,
2323
twitterUsername?: (string | null),

demos/github-demo/src/isograph-components/__isograph/User/RepositoryConnection/raw_response_type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type User__RepositoryConnection__rawResponse = {
22
node____id___v_id: {
3-
__typename: 'User',
3+
__typename: "User",
44
id: string,
55
repositories____first___v_first____after___v_after: {
66
edges: {

demos/pet-demo/src/components/__isograph/AdItem/AdItemDisplay/raw_response_type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type AdItem__AdItemDisplay__rawResponse = {
22
node____id___v_id: {
3-
__typename: 'AdItem',
3+
__typename: "AdItem",
44
id: string,
55
advertiser: string,
66
message: string,

demos/pet-demo/src/components/__isograph/BlogItem/BlogItemMoreDetail/raw_response_type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type BlogItem__BlogItemMoreDetail__rawResponse = {
22
node____id___v_id: {
3-
__typename: 'BlogItem',
3+
__typename: "BlogItem",
44
id: string,
55
moreContent: string,
66
},

demos/pet-demo/src/components/__isograph/Image/ImageDisplay/raw_response_type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type Image__ImageDisplay__rawResponse = {
22
node____id___v_id: {
3-
__typename: 'Image',
3+
__typename: "Image",
44
id: string,
55
url: string,
66
},

demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCard/raw_response_type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type Pet__PetCheckinsCard__rawResponse = {
22
node____id___v_id: {
3-
__typename: 'Pet',
3+
__typename: "Pet",
44
id: string,
55
checkins____skip___v_skip____limit___v_limit: {
66
id: string,

demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCardList/raw_response_type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type Pet__PetCheckinsCardList__rawResponse = {
22
node____id___v_id: {
3-
__typename: 'Pet',
3+
__typename: "Pet",
44
id: string,
55
checkins____skip___v_skip____limit___v_limit: {
66
id: string,

demos/pet-demo/src/components/__isograph/Query/Newsfeed/raw_response_type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ export type Query__Newsfeed__rawResponse = {
22
viewer: {
33
id: string,
44
newsfeed____skip___l_0____limit___l_6: {
5-
__typename: 'AdItem',
5+
__typename: "AdItem",
66
id: string,
77
} | {
8-
__typename: 'BlogItem',
8+
__typename: "BlogItem",
99
id: string,
1010
author: string,
1111
content: string,

0 commit comments

Comments
 (0)