Skip to content

Commit

Permalink
Update checks and use Go v1.21 to 1.23 (#73)
Browse files Browse the repository at this point in the history
* Update checks.yaml

* minimal Go v1.21

* Update README.md

* Delete Makefile

* Fix doc string for Header.Content field

* Update doc strings for header type

* Show diff if go fmt failed
  • Loading branch information
SVilgelm authored Nov 26, 2024
1 parent 18f0600 commit 5be9a1f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 47 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,49 @@ jobs:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
with:
languages: go

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5

UnitTests:
UnitTestJob:
runs-on: ubuntu-latest
strategy:
matrix:
go:
- "1.20"
- "1.21"
- "1.22"
- "1.23"
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: ${{ matrix.go }}
- name: gofmt
run: diff -u <(echo -n) <(gofmt -l . )
- name: show diff
if: ${{ failure() }}
run: git diff
- name: go vet
run: go vet ./...
- name: fieldalignment
run: go vet -vettool=$(which fieldalignment) ./...
- name: Run Unit Tests
run: go test -race -cover -coverprofile=coverage.out -covermode=atomic ./...
- name: Codecov
uses: codecov/[email protected]
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./coverage.out

UnitTests:
needs: UnitTestJob
runs-on: ubuntu-latest
steps:
- run: echo "Unit Tests Passed"
22 changes: 0 additions & 22 deletions Makefile

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ The implementation of OpenAPI v3.1 Specification for Go using generics.

## Supported Go versions:

* v1.23
* v1.22
* v1.21
* v1.20

## Versions:

* v0 - **Deprecated**. The initial version with the full implementation of the v3.1 Specification using generics. See `v0` branch.
* v1 - The current version with the in-place validation of the specification.
The minimal version of Go is `v1.20` and the `github.com/santhosh-tekuri/jsonschema/v5` package is not used anymore.
The minimal version of Go is `v1.21` and the `github.com/santhosh-tekuri/jsonschema/v5` package is not used anymore.
See `main` branch.

## Features
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/sv-tools/openapi

go 1.20
go 1.21.0

retract v0.3.0 // due to a mistake, there is no real v0.3.0 release, it was pointed to v0.2.2 tag

Expand Down
18 changes: 6 additions & 12 deletions spec/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,19 @@ package spec
//
// All fields are copied from Parameter Object as is, except name and in fields.
type Header struct {
// The schema defining the type used for the parameter.
// The schema defining the type used for the header.
Schema *RefOrSpec[Schema] `json:"schema,omitempty" yaml:"schema,omitempty"`
// Examples of the parameter’s potential value.
// Each example SHOULD contain a value in the correct format as specified in the parameter encoding.
// The examples field is mutually exclusive of the example field.
// Furthermore, if referencing a schema that contains an example, the examples value SHALL override the example provided by the schema.
// A map containing the representations for the header.
// The key is the media type and the value describes it.
// The map MUST only contain one entry.
Content map[string]*Extendable[MediaType] `json:"content,omitempty" yaml:"content,omitempty"`
// A brief description of the header.
// This could contain examples of use.
// CommonMark syntax MAY be used for rich text representation.
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Describes how the parameter value will be serialized depending on the type of the parameter value.
// Default values (based on value of in):
// for query - form;
// for path - simple;
// for header - simple;
// for cookie - form.
// Describes how the header value will be serialized.
Style string `json:"style,omitempty" yaml:"style,omitempty"`
// When this is true, parameter values of type array or object generate separate parameters
// When this is true, header values of type array or object generate separate headers
// for each value of the array or key-value pair of the map.
// For other types of parameters this property has no effect.
// When style is form, the default value is true.
Expand Down

0 comments on commit 5be9a1f

Please sign in to comment.