Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: schema first openapi by oapi-codegen #599

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

incubator4
Copy link
Contributor

@incubator4 incubator4 commented Oct 22, 2024

Summary

  1. change openapi.json to yaml
  2. split openapi.yaml with single unti type define
  3. suit code interface to implement generate code ServerInterface
  4. protocol-go define schema mapping and internal schemas package struct mapping
description: The network on which activities occur.
example: ethereum
type: string
x-go-type: network.Network
x-go-type-import:
  path: github.com/rss3-network/protocol-go/schema/network
description: The platform on which activities occur.
example: Uniswap
type: string
x-go-type: decentralized.Platform
x-go-type-skip-optional-pointer: true
x-go-type-import:
  path: github.com/rss3-network/node/schema/worker/decentralized
  1. Reuse openapi schema to reduce duplicate definitions and standardize naming
  2. Fix schema and params defined in code but missing from openapi
  3. Reduce create type, deletegating to generate.go, such as PostDecentralizedAccountsJSONBody
  4. Reduce type checking and validation in http logic ( Delegating to generate.go)
  5. Add server url from config.discovery.server.endpoint

Checklist

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Due to openapi official open api specification. rss path would not generate wildcard path which could match multi-level path. Therefore manually exclude from codegen and add it after generate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant