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
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 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)

View file

@ -31,6 +31,18 @@
};
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
{
devShell.${system} = pkgs.mkShell {
@ -50,6 +62,7 @@
bobgen-sqlite
air
gopls
ogen
];
};
};

View file

@ -1,7 +1,10 @@
openapi: 3.0.3
info:
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
servers:
- url: https://reddit.com
@ -111,7 +114,12 @@ paths:
Maximum value to fetch is `100`.
example: 25
operationId: getSubredditListing
- in: header
name: User-Agent
schema:
type: string
default: bluemage/v1
operationId: getListing
responses:
"200":
description: success
@ -119,6 +127,12 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ListingResponse"
"429":
description: Too many requests
content:
application/json:
schema:
type: object
components:
schemas: