@@ -21,6 +21,15 @@ pub enum Credentials {
21
21
Omit ,
22
22
}
23
23
24
+ #[ derive( Serialize ) ]
25
+ struct GraphiQLVersion < ' a > ( & ' a str ) ;
26
+
27
+ impl < ' a > Default for GraphiQLVersion < ' a > {
28
+ fn default ( ) ->Self {
29
+ Self ( "3" )
30
+ }
31
+ }
32
+
24
33
/// A builder for constructing a GraphiQL (v2) HTML page.
25
34
///
26
35
/// # Example
@@ -40,7 +49,7 @@ pub enum Credentials {
40
49
pub struct GraphiQLSource < ' a > {
41
50
endpoint : & ' a str ,
42
51
subscription_endpoint : Option < & ' a str > ,
43
- version : Option < & ' a str > ,
52
+ version : GraphiQLVersion < ' a > ,
44
53
headers : Option < HashMap < & ' a str , & ' a str > > ,
45
54
ws_connection_params : Option < HashMap < & ' a str , & ' a str > > ,
46
55
title : Option < & ' a str > ,
@@ -81,7 +90,7 @@ impl<'a> GraphiQLSource<'a> {
81
90
/// Sets the version of GraphiQL to be fetched.
82
91
pub fn version ( self , value : & ' a str ) ->GraphiQLSource < ' a > {
83
92
GraphiQLSource {
84
- version : Some ( value) ,
93
+ version : GraphiQLVersion ( value) ,
85
94
..self
86
95
}
87
96
}
@@ -174,13 +183,13 @@ mod tests {
174
183
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
175
184
></script>
176
185
<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" />
178
187
</head>
179
188
180
189
<body>
181
190
<div id="graphiql">Loading...</div>
182
191
<script
183
- src="https://unpkg.com/graphiql/graphiql.min.js"
192
+ src="https://unpkg.com/graphiql@3 /graphiql.min.js"
184
193
type="application/javascript"
185
194
></script>
186
195
<script>
@@ -251,13 +260,13 @@ mod tests {
251
260
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
252
261
></script>
253
262
<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" />
255
264
</head>
256
265
257
266
<body>
258
267
<div id="graphiql">Loading...</div>
259
268
<script
260
- src="https://unpkg.com/graphiql/graphiql.min.js"
269
+ src="https://unpkg.com/graphiql@3 /graphiql.min.js"
261
270
type="application/javascript"
262
271
></script>
263
272
<script>