Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CORE_COV_DIR := $(COVERAGE_DIR)/core
ADAPTER_COV_ROOT := $(COVERAGE_DIR)/adapters
MERGED_COV_DIR := $(COVERAGE_DIR)/merged
CORE_COV_ABS := $(abspath $(CORE_COV_DIR))
ADAPTERS := chiopenapi echoopenapi fiberopenapi ginopenapi httpopenapi muxopenapi echov5openapi fiberv3openapi
ADAPTERS := chiopenapi echoopenapi fiberopenapi ginopenapi irisopenapi httpopenapi muxopenapi echov5openapi fiberv3openapi

# Platform detection for sed compatibility
# Using an immediately expanded variable for this is good practice.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Use the core `spec` package for static generation and CI workflows. Use an adapt
| Fiber v2 | [`fiberopenapi`](/adapter/fiberopenapi) |
| Fiber v3 | [`fiberv3openapi`](/adapter/fiberv3openapi) |
| Gin | [`ginopenapi`](/adapter/ginopenapi) |
| Iris | [`irisopenapi`](/adapter/irisopenapi) |
| net/http | [`httpopenapi`](/adapter/httpopenapi) |
| Mux | [`muxopenapi`](/adapter/muxopenapi) |

Expand All @@ -153,6 +154,7 @@ Adapter module import paths:
- `github.com/oaswrap/spec/adapter/fiberopenapi`
- `github.com/oaswrap/spec/adapter/fiberv3openapi`
- `github.com/oaswrap/spec/adapter/ginopenapi`
- `github.com/oaswrap/spec/adapter/irisopenapi`
- `github.com/oaswrap/spec/adapter/httpopenapi`
- `github.com/oaswrap/spec/adapter/muxopenapi`

Expand Down
3 changes: 2 additions & 1 deletion adapter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ This directory contains framework-specific adapters for `oaswrap/spec` that prov
| [Fiber v2](https://github.com/gofiber/fiber) | [`fiberopenapi`](./fiberopenapi) | `github.com/oaswrap/spec/adapter/fiberopenapi` | Express-inspired framework built on Fasthttp |
| [Fiber v3](https://github.com/gofiber/fiber) | [`fiberv3openapi`](./fiberv3openapi) | `github.com/oaswrap/spec/adapter/fiberv3openapi` | Fiber v3 with updated Ctx interface and binding API |
| [Gin](https://github.com/gin-gonic/gin) | [`ginopenapi`](./ginopenapi) | `github.com/oaswrap/spec/adapter/ginopenapi` | Fast HTTP web framework with zero allocation |
| [Iris](https://github.com/kataras/iris) | [`irisopenapi`](./irisopenapi) | `github.com/oaswrap/spec/adapter/irisopenapi` | Full-featured web framework with MVC support |
| [net/http](https://pkg.go.dev/net/http) | [`httpopenapi`](./httpopenapi) | `github.com/oaswrap/spec/adapter/httpopenapi` | Standard library HTTP package |
| [Gorilla Mux](https://github.com/gorilla/mux) | [`muxopenapi`](./muxopenapi) | `github.com/oaswrap/spec/adapter/muxopenapi` | Powerful HTTP router and URL matcher |
| [Gorilla Mux](https://github.com/gorilla/mux) | [`muxopenapi`](./muxopenapi) | `github.com/oaswrap/spec/adapter/muxopenapi` | Powerful HTTP router and URL matcher |
50 changes: 50 additions & 0 deletions adapter/irisopenapi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# irisopenapi

[![Go Reference](https://pkg.go.dev/badge/github.com/oaswrap/spec/adapter/irisopenapi.svg)](https://pkg.go.dev/github.com/oaswrap/spec/adapter/irisopenapi)
[![Go Report Card](https://goreportcard.com/badge/github.com/oaswrap/spec/adapter/irisopenapi)](https://goreportcard.com/report/github.com/oaswrap/spec/adapter/irisopenapi)

A lightweight adapter for the [Iris](https://github.com/kataras/iris) web framework that automatically generates OpenAPI 3.x specifications from your routes using [`oaswrap/spec`](https://github.com/oaswrap/spec).

## Installation

```bash
go get github.com/oaswrap/spec/adapter/irisopenapi
```

## Quick Start

```go
package main

import (
"github.com/kataras/iris/v12"
"github.com/oaswrap/spec/adapter/irisopenapi"
"github.com/oaswrap/spec/option"
)

func main() {
app := iris.New()
r := irisopenapi.NewRouter(app,
option.WithTitle("My API"),
option.WithVersion("1.0.0"),
)

r.Get("/ping", func(ctx iris.Context) {
_ = ctx.JSON(map[string]string{"message": "pong"})
}).With(
option.OperationID("ping"),
option.Response(200, new(struct {
Message string `json:"message"`
})),
)

_ = app.Listen(":8080")
}
```

## Built-in Endpoints

- `/docs` for interactive API docs UI.
- `/docs/openapi.yaml` for raw OpenAPI YAML.

Use `option.WithDisableDocs(true)` to disable docs endpoints.
60 changes: 60 additions & 0 deletions adapter/irisopenapi/example/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
module github.com/oaswrap/spec/adapter/irisopenapi/example

go 1.25.0

require (
github.com/kataras/iris/v12 v12.2.11
github.com/oaswrap/spec v0.5.0-rc.1
github.com/oaswrap/spec/adapter/irisopenapi v0.0.0
)

require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect
github.com/CloudyKit/jet/v6 v6.2.0 // indirect
github.com/Joker/jade v1.1.3 // indirect
github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 // indirect
github.com/andybalholm/brotli v1.2.1 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/flosch/pongo2/v4 v4.0.2 // indirect
github.com/goccy/go-yaml v1.19.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gomarkdown/markdown v0.0.0-20240328165702-4d01890c35c0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/iris-contrib/schema v0.0.6 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/kataras/blocks v0.0.8 // indirect
github.com/kataras/golog v0.1.11 // indirect
github.com/kataras/pio v0.0.13 // indirect
github.com/kataras/sitemap v0.0.6 // indirect
github.com/kataras/tunnel v0.0.4 // indirect
github.com/klauspost/compress v1.18.6 // indirect
github.com/mailgun/raymond/v2 v2.0.48 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
github.com/oaswrap/spec-ui v0.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/schollz/closestmatch v2.1.0+incompatible // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/tdewolff/minify/v2 v2.20.19 // indirect
github.com/tdewolff/parse/v2 v2.7.12 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yosssi/ace v0.0.5 // indirect
golang.org/x/crypto v0.51.0 // indirect
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect
golang.org/x/net v0.54.0 // indirect
golang.org/x/sys v0.44.0 // indirect
golang.org/x/text v0.37.0 // indirect
golang.org/x/time v0.15.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/oaswrap/spec => ../../..

replace github.com/oaswrap/spec/adapter/irisopenapi => ..
Loading
Loading