-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/endpoint-for-swagger'
- Loading branch information
Showing
10 changed files
with
509 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package api | ||
|
||
import ( | ||
"bytes" | ||
"context" | ||
"github.com/go-faster/jx" | ||
"github.com/tonkeeper/opentonapi/pkg/oas" | ||
"net/http" | ||
"os" | ||
) | ||
|
||
func (h *Handler) GetOpenapiJson(ctx context.Context) (jx.Raw, error) { | ||
file, err := os.ReadFile("openapi/openapi.json") | ||
if err != nil { | ||
return jx.Raw{}, toError(http.StatusInternalServerError, err) | ||
} | ||
d := jx.DecodeBytes(file) | ||
result, err := d.Raw() | ||
if err != nil { | ||
return jx.Raw{}, toError(http.StatusInternalServerError, err) | ||
} | ||
return result, nil | ||
} | ||
|
||
func (h *Handler) GetOpenapiYml(ctx context.Context) (oas.GetOpenapiYmlOK, error) { | ||
file, err := os.ReadFile("openapi/openapi.yml") | ||
if err != nil { | ||
return oas.GetOpenapiYmlOK{}, toError(http.StatusInternalServerError, err) | ||
} | ||
return oas.GetOpenapiYmlOK{ | ||
Data: bytes.NewReader(file), | ||
}, nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.