Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24d3703

Browse files
yasamokasunli829
authored andcommitted
Pin GraphiQL major version by default
1 parentffc987f commit24d3703

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

‎src/http/graphiql_v2_source.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
3434
></script>
3535
<linkrel="icon"href="https://graphql.org/favicon.ico">
36-
<linkrel="stylesheet"href="https://unpkg.com/graphiql{{#ifversion}}@{{version}}{{/if}}/graphiql.min.css" />
36+
<linkrel="stylesheet"href="https://unpkg.com/graphiql@{{version}}/graphiql.min.css" />
3737
{{! plugins head assests }}
3838
{{#ifplugins}}
3939
{{#eachplugins}}
@@ -48,7 +48,7 @@
4848
<body>
4949
<divid="graphiql">Loading...</div>
5050
<script
51-
src="https://unpkg.com/graphiql{{#ifversion}}@{{version}}{{/if}}/graphiql.min.js"
51+
src="https://unpkg.com/graphiql@{{version}}/graphiql.min.js"
5252
type="application/javascript"
5353
></script>
5454
{{! plugins body assests }}

‎src/http/graphiql_v2_source.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ pub enum Credentials {
2121
Omit,
2222
}
2323

24+
#[derive(Serialize)]
25+
structGraphiQLVersion<'a>(&'astr);
26+
27+
impl<'a>DefaultforGraphiQLVersion<'a>{
28+
fndefault() ->Self{
29+
Self("3")
30+
}
31+
}
32+
2433
/// A builder for constructing a GraphiQL (v2) HTML page.
2534
///
2635
/// # Example
@@ -40,7 +49,7 @@ pub enum Credentials {
4049
pubstructGraphiQLSource<'a>{
4150
endpoint:&'astr,
4251
subscription_endpoint:Option<&'astr>,
43-
version:Option<&'astr>,
52+
version:GraphiQLVersion<'a>,
4453
headers:Option<HashMap<&'astr,&'astr>>,
4554
ws_connection_params:Option<HashMap<&'astr,&'astr>>,
4655
title:Option<&'astr>,
@@ -81,7 +90,7 @@ impl<'a> GraphiQLSource<'a> {
8190
/// Sets the version of GraphiQL to be fetched.
8291
pubfnversion(self,value:&'astr) ->GraphiQLSource<'a>{
8392
GraphiQLSource{
84-
version:Some(value),
93+
version:GraphiQLVersion(value),
8594
..self
8695
}
8796
}
@@ -174,13 +183,13 @@ mod tests {
174183
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
175184
></script>
176185
<link rel="icon" href="https://graphql.org/favicon.ico">
177-
<link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
186+
<link rel="stylesheet" href="https://unpkg.com/graphiql@3/graphiql.min.css" />
178187
</head>
179188
180189
<body>
181190
<div id="graphiql">Loading...</div>
182191
<script
183-
src="https://unpkg.com/graphiql/graphiql.min.js"
192+
src="https://unpkg.com/graphiql@3/graphiql.min.js"
184193
type="application/javascript"
185194
></script>
186195
<script>
@@ -251,13 +260,13 @@ mod tests {
251260
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
252261
></script>
253262
<link rel="icon" href="https://graphql.org/favicon.ico">
254-
<link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
263+
<link rel="stylesheet" href="https://unpkg.com/graphiql@3/graphiql.min.css" />
255264
</head>
256265
257266
<body>
258267
<div id="graphiql">Loading...</div>
259268
<script
260-
src="https://unpkg.com/graphiql/graphiql.min.js"
269+
src="https://unpkg.com/graphiql@3/graphiql.min.js"
261270
type="application/javascript"
262271
></script>
263272
<script>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp