reddit: update open api spec

This commit is contained in:
Tigor Hutasuhut 2024-08-11 16:55:53 +07:00
parent 230138cecd
commit 4f2c0ec7b3
3 changed files with 43 additions and 15 deletions

View file

@ -16,6 +16,7 @@ run-web: generate-web
generate-go: migrate generate-go: migrate
rm -rf go/gen/* rm -rf go/gen/*
ogen -target go/gen/reddit -package reddit -clean schemas/openapi/reddit.yaml
(cd ./schemas/proto && buf generate --template buf.gen.go.yaml .) (cd ./schemas/proto && buf generate --template buf.gen.go.yaml .)
(cd go/gen && bobgen-sqlite --config ../bobgen.yaml) (cd go/gen && bobgen-sqlite --config ../bobgen.yaml)
(cd go && goverter gen -g 'output:file ../gen/converter/converter.go' -g 'output:package github.com/tigorlazuardi/bluemage/go/gen/converter' ./converts) (cd go && goverter gen -g 'output:file ../gen/converter/converter.go' -g 'output:package github.com/tigorlazuardi/bluemage/go/gen/converter' ./converts)

View file

@ -31,6 +31,18 @@
}; };
vendorHash = "sha256-9vLcyCAhW/Dq0zV8FhM0T3Ofn/8XsUhV5KlphNidGDw="; vendorHash = "sha256-9vLcyCAhW/Dq0zV8FhM0T3Ofn/8XsUhV5KlphNidGDw=";
}; };
ogen = pkgs.buildGoModule rec {
name = "ogen";
version = "1.2.2";
subPackages = [ "cmd/ogen" ];
src = pkgs.fetchFromGitHub {
owner = "ogen-go";
repo = "ogen";
rev = "v${version}";
sha256 = "sha256-8HIbMw3G5vuOJMpwfrSiecm9+kmsHDkVqAG6xucoZfs=";
};
vendorHash = "sha256-sZiOo+ZhczWS7xMt2cxdqZM1C2omIYheZPLAJMLSw28=";
};
in in
{ {
devShell.${system} = pkgs.mkShell { devShell.${system} = pkgs.mkShell {
@ -50,6 +62,7 @@
bobgen-sqlite bobgen-sqlite
air air
gopls gopls
ogen
]; ];
}; };
}; };

View file

@ -1,7 +1,10 @@
openapi: 3.0.3 openapi: 3.0.3
info: info:
title: Reddit JSON Listing API title: Reddit JSON Listing API
description: JSON api listing for Subreddits and Users. description: |-
JSON api listing for Subreddits and Users.
Request must have `User-Agent` header set to custom values and not empty.
version: v1 version: v1
servers: servers:
- url: https://reddit.com - url: https://reddit.com
@ -111,7 +114,12 @@ paths:
Maximum value to fetch is `100`. Maximum value to fetch is `100`.
example: 25 example: 25
operationId: getSubredditListing - in: header
name: User-Agent
schema:
type: string
default: bluemage/v1
operationId: getListing
responses: responses:
"200": "200":
description: success description: success
@ -119,6 +127,12 @@ paths:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/ListingResponse" $ref: "#/components/schemas/ListingResponse"
"429":
description: Too many requests
content:
application/json:
schema:
type: object
components: components:
schemas: schemas: