Skip to content

Commit 574bd10

Browse files
authored
Merge pull request #373 from the-hideout/achievement-documentation
Improve formatting/documentation for Achievement type
2 parents fa17f5f + 7dab825 commit 574bd10

File tree

3 files changed

+79
-2
lines changed

3 files changed

+79
-2
lines changed

schema-dynamic.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ enum HandbookCategoryName {
1414
${handbookCategories}
1515
}
1616
enum LanguageCode {
17-
${languageCodes}
17+
${languageCodes}
1818
}
1919
`;
2020
};

schema-static.mjs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,47 @@
11
export default `
2+
"""
3+
**In-game achievements players can earn by completing specific objectives.**
4+
"""
25
type Achievement {
6+
"""
7+
A unique 24-character hexadecimal identifier for the achievement. Follows a consistent format across all achievements.
8+
"""
39
id: ID!
10+
"""
11+
The display name of the achievement (e.g., "Welcome to Tarkov", "The Kappa Path").
12+
"""
413
name: String!
14+
"""
15+
Text describing the conditions required to unlock the achievement (e.g., "Neutralize Killa 15 times while playing as a PMC").
16+
"""
517
description: String
18+
"""
19+
Whether the achievement is hidden from players until unlocked (true) or visible from the start (false).
20+
"""
621
hidden: Boolean!
22+
"""
23+
Raw percentage of all players who have completed this achievement (e.g., 0.06, 43.48).
24+
"""
725
playersCompletedPercent: Float!
26+
"""
27+
Statistically adjusted percentage that accounts for active players, providing a more representative completion rate. Uses the percentage completion of Welcome to Tarkov as the baseline under the assumption that all active accounts have died once.
28+
"""
829
adjustedPlayersCompletedPercent: Float
30+
"""
31+
The game faction or player type this achievement is associated with. Values include "PMC", "All", or "Scavs".
32+
"""
933
side: String
34+
"""
35+
Lowercase, standardized version of the side field used for consistent sorting and filtering (e.g., "pmc", "all", "scavs").
36+
"""
1037
normalizedSide: String
38+
"""
39+
The difficulty/rarity tier of the achievement. Values include "Common", "Rare", or "Legendary".
40+
"""
1141
rarity: String
42+
"""
43+
Lowercase, standardized version of the rarity field used for consistent sorting and filtering (e.g., "common", "rare", "legendary").
44+
"""
1245
normalizedRarity: String
1346
}
1447
@@ -1500,4 +1533,4 @@ type TraderResetTime {
15001533
name: String @deprecated(reason: "Use Trader.name type instead.")
15011534
resetTimestamp: String @deprecated(reason: "Use Trader.resetTime type instead.")
15021535
}
1503-
`;
1536+
`

test-playground.mjs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env node
2+
3+
/*
4+
Local GraphQL Playground for static schema (SDL) development/testing.
5+
- Runs a standalone server on http://localhost:4000/graphql
6+
- Uses only the static SDL (schema-static.mjs) and stub scalars
7+
- Does not use dynamic data or production API logic
8+
- Useful for viewing schema docs and testing queries against the static schema
9+
- Not used in production or deployment
10+
*/
11+
12+
import http from 'http'
13+
import { createYoga } from 'graphql-yoga'
14+
import { makeExecutableSchema } from '@graphql-tools/schema'
15+
import staticSDL from './schema-static.mjs'
16+
17+
// Stubs for custom scalars referenced in staticSDL
18+
const stubSDL = `
19+
scalar LanguageCode
20+
scalar ItemType
21+
scalar ItemCategoryName
22+
scalar HandbookCategoryName
23+
`
24+
25+
// Build schema from static SDL and stubs
26+
const schema = makeExecutableSchema({
27+
typeDefs: [staticSDL, stubSDL],
28+
resolvers: {},
29+
})
30+
31+
// Enable GraphiQL at /graphql for local exploration
32+
const yoga = createYoga({
33+
schema,
34+
graphiql: true,
35+
})
36+
37+
// Start HTTP server on port 4000
38+
const server = http.createServer(yoga)
39+
const PORT = 4000
40+
server.listen(PORT, () => {
41+
console.log(
42+
`🚀 GraphQL Playground running at http://localhost:${PORT}/graphql`
43+
)
44+
})

0 commit comments

Comments
 (0)