Created
March 22, 2026 02:31
-
-
Save ronanyeah/6181c83f994212a9b503428e01863050 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Codegen.Api exposing (simpleHandler, simpleHandlerTask) | |
| {-| | |
| ## Operations | |
| @docs simpleHandler, simpleHandlerTask | |
| -} | |
| import Codegen.Json | |
| import Codegen.Types | |
| import Dict | |
| import Http | |
| import Json.Decode | |
| import OpenApi.Common | |
| import Task | |
| import Url.Builder | |
| simpleHandler config = | |
| Http.request | |
| { url = Url.Builder.crossOrigin "http://localhost:8888" [ "simple" ] [] | |
| , method = "GET" | |
| , headers = [] | |
| , expect = | |
| OpenApi.Common.expectJsonCustom | |
| (Dict.fromList []) | |
| Codegen.Json.decodeData1 | |
| config.toMsg | |
| , body = Http.emptyBody | |
| , timeout = Nothing | |
| , tracker = Nothing | |
| } | |
| simpleHandlerTask : {} -> Task.Task (OpenApi.Common.Error e String) Codegen.Types.Data1 | |
| simpleHandlerTask config = | |
| Http.task | |
| { url = Url.Builder.crossOrigin "http://localhost:8888" [ "simple" ] [] | |
| , method = "GET" | |
| , headers = [] | |
| , resolver = | |
| OpenApi.Common.jsonResolverCustom | |
| (Dict.fromList []) | |
| Codegen.Json.decodeData1 | |
| , body = Http.emptyBody | |
| , timeout = Nothing | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.1.0", | |
| "info": { | |
| "title": "Codegen", | |
| "description": "", | |
| "license": { | |
| "name": "" | |
| }, | |
| "version": "1.0.0" | |
| }, | |
| "paths": { | |
| "/simple": { | |
| "get": { | |
| "operationId": "simple_handler", | |
| "responses": { | |
| "200": { | |
| "description": "", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/Data1" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "components": { | |
| "schemas": { | |
| "Data1": { | |
| "type": "object", | |
| "required": [ | |
| "value2" | |
| ], | |
| "properties": { | |
| "value2": { | |
| "type": "integer", | |
| "format": "int32" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment