{"openapi":"3.0.2","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/wordseg":{"pos…
- User
{"openapi":"3.0.2","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/wordseg":{"post":{"summary":"Wordseg","operationId":"wordseg_wordseg_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"ref":"#/components/schemas/Body_wordseg_wordseg_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/daily":{"get":{"summary":"Guess Daily","description":"Guess against the daily puzzle","operationId":"guess_daily_daily_get","parameters":[{"required":true,"schema":{"title":"Guess","type":"string"},"name":"guess","in":"query"},{"required":false,"schema":{"title":"Size","type":"integer","default":5},"name":"size","in":"query"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Guess Daily Daily Get","type":"array","items":{"ref":"#/components/schemas/GuessResult"}}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/random":{"get":{"summary":"Guess Random","description":"Guess against a random word","operationId":"guess_random_random_get","parameters":[{"required":true,"schema":{"title":"Guess","type":"string"},"name":"guess","in":"query"},{"required":false,"schema":{"title":"Size","type":"integer","default":5},"name":"size","in":"query"},{"required":false,"schema":{"title":"Seed","type":"integer"},"name":"seed","in":"query"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Guess Random Random Get","type":"array","items":{"ref":"#/components/schemas/GuessResult"}}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/word/{word}":{"get":{"summary":"Guess Word","description":"Guess against a selected word","operationId":"guess_word_word__word__get","parameters":[{"required":true,"schema":{"title":"Word","type":"string"},"name":"word","in":"path"},{"required":true,"schema":{"title":"Guess","type":"string"},"name":"guess","in":"query"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Guess Word Word Word Get","type":"array","items":{"ref":"#/components/schemas/GuessResult"}}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_wordseg_wordseg_post":{"title":"Body_wordseg_wordseg_post","required":["text"],"type":"object","properties":{"text":{"title":"Text","type":"string"}}},"GuessResult":{"title":"GuessResult","required":["slot","guess","result"],"type":"object","properties":{"slot":{"title":"Slot","type":"integer"},"guess":{"title":"Guess","type":"string"},"result":{"ref":"#/components/schemas/ResultKind"}}},"HTTPValidationError":{"title":"HTTPValidationError","type":"object","properties":{"detail":{"title":"Detail","type":"array","items":{"ref":"#/components/schemas/ValidationError"}}}},"ResultKind":{"title":"ResultKind","enum":["absent","present","correct"],"type":"string","description":"An enumeration."},"ValidationError":{"title":"ValidationError","required":["loc","msg","type"],"type":"object","properties":{"loc":{"title":"Location","type":"array","items":{"type":"string"}},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}}}}}}
- Assistant
The OpenAPI specification provided describes an API with various endpoints related to word guessing games and word segmentation. Here's a breakdown of the API endpoints and their functionality:
Endpoints
-
Word Segmentation (
/wordseg)- POST: Submit text for word segmentation.
- Request Body: Form data with a
textfield (required). - Responses:
- 200: Successful Response.
- 422: Validation Error.
- Request Body: Form data with a
- POST: Submit text for word segmentation.
-
Guess Daily (
/daily)- GET: Make a guess against the daily puzzle.
- Query Parameters:
guess(required): The guess string.size(optional, default: 5): The size of the word.
- Responses:
- 200: Successful Response, returns an array of
GuessResult. - 422: Validation Error.
- 200: Successful Response, returns an array of
- Query Parameters:
- GET: Make a guess against the daily puzzle.
-
Guess Random (
/random)- GET: Make a guess against a random word.
- Query Parameters:
guess(required): The guess string.size(optional, default: 5): The size of the word.seed(optional): Seed for random word generation.
- Responses:
- 200: Successful Response, returns an array of
GuessResult. - 422: Validation Error.
- 200: Successful Response, returns an array of
- Query Parameters:
- GET: Make a guess against a random word.
-
Guess Word (
/word/{word})- GET: Make a guess against a selected word.
- Path Parameter:
word(required): The target word.
- Query Parameters:
guess(required): The guess string.
- Responses:
- 200: Successful Response, returns an array of
GuessResult. - 422: Validation Error.
- 200: Successful Response, returns an array of
- Path Parameter:
- GET: Make a guess against a selected word.
Components
- Schemas:
- Body_wordseg_wordseg_post:
- Properties:
text(string, required): The text to be segmented.
- Properties:
- GuessResult:
- Properties:
slot(integer): The position of the guess.guess(string): The guessed word.result(enum): Result of the guess, can be "absent", "present", or "correct".
- Properties:
- HTTPValidationError:
- Properties:
detail(array ofValidationErrors): Details of the validation error.
- Properties:
- ResultKind:
- Description: An enumeration of possible guess results.
- Enum Values: "absent", "present", "correct".
- ValidationError:
- Properties:
loc(array of strings): Location of the error.msg(string): Error message.type(string): Type of error.
- Properties:
- Body_wordseg_wordseg_post:
Usage
- Word Segmentation: Use the
/wordsegendpoint to submit text for segmentation. - Daily Guess Game: Use the
/dailyendpoint to make guesses on the daily puzzle. - Random Guess Game: Use the
/randomendpoint to make guesses against a randomly generated word. - Specific Word Guess Game: Use the
/word/{word}endpoint to guess a specific word provided in the path.
Each guessing endpoint provides a
GuessResultarray, indicating the outcome of each guess, with possible results being "absent", "present", or "correct". Validation errors are captured and detailed in theHTTPValidationErrorschema.This API can be useful for applications involving word games, such as word puzzles or educational tools aimed at vocabulary enhancement.
-