• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mindersec / minder / 12763662487
58%

Build:
DEFAULT BRANCH: main
Ran 14 Jan 2025 08:31AM UTC
Jobs 1
Files 315
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 Jan 2025 08:20AM UTC coverage: 56.625% (+0.008%) from 56.617%
12763662487

push

github

web-flow
mindev: Add utility to generate a data source definition from a Swagger doc (#5283)

* mindev: Add utility to generate a data source definition from a Swagger doc

This adds the following command: `mindev datasource generate ...`

The aforementioned command will read a swagger doc (OpenAPI v2) and will
generate the appropriate data source definition out of it.

I went for v2 since there was an easy-to-use implementation ready.
Adding v3 support is left as a TODO item.

Here's a demo of how usage would look like:

```
$ cat sample.yaml
swagger: "2.0"

info:
  title: Sample API
  description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.
  version: 0.1.9

basePath: http://api.example.com/v1

paths:
  /users:
    get:
      summary: Returns a list of users.
      description: Optional extended description in CommonMark or HTML.
      responses:
        "200": # status code
          description: A JSON array of user names
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string

$ go run cmd/dev/main.go datasource generate sample.yaml
version: v1
type: data-source
context: {}
name: Sample-API
rest:
  def:
    get_users:
      endpoint: http://api.example.com/v1/users
      method: GET
      parse: json
      inputSchema: {}

```

Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>

* Update cmd/dev/app/datasource/datasource.go

Co-authored-by: Radoslav Dimitrov <radoslav@stacklok.com>

* Update cmd/dev/app/datasource/generate.go

Co-authored-by: Radoslav Dimitrov <radoslav@stacklok.com>

---------

Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
Co-authored-by: Radoslav Dimitrov <radoslav@stacklok.com>

17586 of 31057 relevant lines covered (56.62%)

37.93 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
2
73.73
-0.85% internal/eea/eea.go
92
80.34
-0.29% internal/engine/eval/rego/lib.go
Jobs
ID Job ID Ran Files Coverage
1 12763662487.1 14 Jan 2025 08:31AM UTC 315
56.62
GitHub Action Run
Source Files on build 12763662487
  • Tree
  • List 315
  • Changed 17
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #12763662487
  • ca1e9121 on github
  • Prev Build on main (#12762631552)
  • Next Build on main (#12764163914)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc