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

[API] OpenAPI Spec Fixes #988

Open
5 tasks
Olshansk opened this issue Dec 6, 2024 · 0 comments
Open
5 tasks

[API] OpenAPI Spec Fixes #988

Olshansk opened this issue Dec 6, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Olshansk
Copy link
Member

Olshansk commented Dec 6, 2024

Objective

Fix the generated OpenAPI spec.

Origin Document

Background

pocket-core (Morse) has a really nice OpenAPI spec that I like to link to: https://editor.swagger.io/?url=https://raw.githubusercontent.com/pokt-network/pocket-core/staging/doc/specs/rpc-spec.yaml

It would be helpful to have an easily accessible swagger populated by the spec in Shannon as well.

Bug

If make ignite_openapi_gen is run on main, the resulting openapi.yml file is:

{
  "id": "github.com/pokt-network/poktroll",
  "consumes": ["application/json"],
  "produces": ["application/json"],
  "swagger": "2.0",
  "info":
    {
      "description": "Chain github.com/pokt-network/poktroll REST API",
      "title": "HTTP API Console",
      "contact": { "name": "github.com/pokt-network/poktroll" },
      "version": "version not set",
    },
  "paths": {},
  "definitions":
    {
      "google.protobuf.Any":
        {
          "type": "object",
          "properties": { "@type": { "type": "string" } },
          "additionalProperties": {},
        },
      "google.rpc.Status":
        {
          "type": "object",
          "properties":
            {
              "code": { "type": "integer", "format": "int32" },
              "details":
                {
                  "type": "array",
                  "items":
                    {
                      "type": "object",
                      "$ref": "#/definitions/google.protobuf.Any",
                    },
                },
              "message": { "type": "string" },
            },
        },
    },
}

In order to fix it, we need:

  1. git reset --hard acd7fc8a60f44a05a117050c441609361dd608d3
  2. Comment out staking_fee in proto/poktroll/supplier/params.proto
  3. Rerun make ignite_openapi_gen

Goals

  • Make the OpenAPI spec of Shannon easily accessible
  • Make the OpenAPI spec of Shannon easily accessible
  • Fixing existing bugs on main related to generated the spec

Deliverables

  • Figure out why a bug was introduced (see the background section)
  • After fixing ☝️, Replace all instances of openapi.yml in the code with openapi.json (it was incorrect)
  • Add a link to swagger pointing to the raw (correct) openapi spec in README and docusaurus/README
  • Optionally, find a way to autoformat the generated spec in version control
  • Optionally, find a way to have an easily accessibly .yml file in version control

Creator: @Olshansk
Co-Owners: @bryanchriswhite

@Olshansk Olshansk added the bug Something isn't working label Dec 6, 2024
@Olshansk Olshansk added this to the Shannon Beta TestNet Support milestone Dec 6, 2024
@Olshansk Olshansk added this to Shannon Dec 6, 2024
@Olshansk Olshansk moved this to 🔖 Ready in Shannon Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🔖 Ready
Development

No branches or pull requests

2 participants