Skip to content
Open
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 .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Feature request
name: Feature requestaaaaaa
about: Suggest an idea for this project
Comment on lines 1 to 3
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 | Confidence: High

The change appears to be a test or typo ("requestaaaaaa") in a template file name. This degrades the professionalism of the project's issue templates and could confuse users trying to submit feature requests. It's a minor maintainability issue.

Suggested change
---
name: Feature request
name: Feature requestaaaaaa
about: Suggest an idea for this project
---
name: Feature request
about: Suggest an idea for this project

title: ''
labels: ''
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/gocan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: layout-only changes
on:
pull_request:

# Cancel the workflow in progress if a newer build is about to start.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
gocan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Annotate layout-only changes
run: |
curl -sLO https://github.com/vearutop/gocan/releases/download/v0.0.6/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz
gocan_hash=$(git hash-object ./gocan)
[ "$gocan_hash" == "3ff3d1bd62d8a1c459ed68ca9dd997afcac1cfcc" ] || (echo "::error::unexpected hash for gocan, possible tampering: $gocan_hash" && exit 1)
git fetch --no-tags --depth=1 origin ${{ github.event.pull_request.base.sha }}
git fetch --no-tags --depth=1 origin ${{ github.event.pull_request.head.sha }}
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} ./gocan -gh-checks -gh-base ${{ github.event.pull_request.base.sha }} -gh-head ${{ github.event.pull_request.head.sha }}
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# Optional: show only new issues if it's a pull requestaaaaaa. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the action will use pre-installed Go.
Expand Down
10 changes: 5 additions & 5 deletions _examples/advanced-generic-openapi31/error_response.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//go:build go1.18

Check notice on line 1 in _examples/advanced-generic-openapi31/error_response.go

View workflow job for this annotation

GitHub Actions / gocan layout-only

_examples/advanced-generic-openapi31/error_response.go#L1

Package _examples/advanced-generic-openapi31: Layout-only: type customErr, type formOrJSONInput, formOrJSONInput.ForceJSONRequestBody, type gzipPassThroughContainer, gzipPassThroughContainer.gzipPassThroughStruct, type gzipPassThroughInput, +14 more

package main
Expand All @@ -11,11 +11,6 @@
"github.com/swaggest/usecase/status"
)

type customErr struct {
Message string `json:"msg"`
Details map[string]interface{} `json:"details,omitempty"`
}

func errorResponse() usecase.Interactor {
type errType struct {
Type string `query:"type" enum:"ok,invalid_argument,conflict" required:"true"`
Expand Down Expand Up @@ -56,3 +51,8 @@
func (anotherErr) Error() string {
return "foo happened"
}

type customErr struct {
Message string `json:"msg"`
Details map[string]interface{} `json:"details,omitempty"`
}
16 changes: 8 additions & 8 deletions _examples/advanced-generic-openapi31/form_or_json.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package main

import (
Expand All @@ -6,14 +6,6 @@
"github.com/swaggest/usecase"
)

type formOrJSONInput struct {
Field1 string `json:"field1" formData:"field1" required:"true"`
Field2 int `json:"field2" formData:"field2" required:"true"`
Field3 string `path:"path" required:"true"`
}

func (formOrJSONInput) ForceJSONRequestBody() {}

func formOrJSON() usecase.Interactor {
type formOrJSONOutput struct {
F1 string `json:"f1"`
Expand All @@ -34,3 +26,11 @@

return u
}

type formOrJSONInput struct {
Field1 string `json:"field1" formData:"field1" required:"true"`
Field2 int `json:"field2" formData:"field2" required:"true"`
Field3 string `path:"path" required:"true"`
}

func (formOrJSONInput) ForceJSONRequestBody() {}
82 changes: 41 additions & 41 deletions _examples/advanced-generic-openapi31/gzip_pass_through.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//go:build go1.18

package main
Expand All @@ -9,47 +9,6 @@
"github.com/swaggest/usecase"
)

type gzipPassThroughInput struct {
PlainStruct bool `query:"plainStruct" description:"Output plain structure instead of gzip container."`
CountItems bool `query:"countItems" description:"Invokes internal decoding of compressed data."`
}

// gzipPassThroughOutput defers data to an accessor function instead of using struct directly.
// This is necessary to allow containers that can data in binary wire-friendly format.
type gzipPassThroughOutput interface {
// Data should be accessed though an accessor to allow container interface.
gzipPassThroughStruct() gzipPassThroughStruct
}

// gzipPassThroughStruct represents the actual structure that is held in the container
// and implements gzipPassThroughOutput to be directly useful in output.
type gzipPassThroughStruct struct {
Header string `header:"X-Header" json:"-"`
ID int `json:"id"`
Text []string `json:"text"`
}

func (d gzipPassThroughStruct) gzipPassThroughStruct() gzipPassThroughStruct {
return d
}

// gzipPassThroughContainer is wrapping gzip.JSONContainer and implements gzipPassThroughOutput.
type gzipPassThroughContainer struct {
Header string `header:"X-Header" json:"-"`
gzip.JSONContainer
}

func (dc gzipPassThroughContainer) gzipPassThroughStruct() gzipPassThroughStruct {
var p gzipPassThroughStruct

err := dc.UnpackJSON(&p)
if err != nil {
panic(err)
}

return p
}

func directGzip() usecase.Interactor {
// Prepare moderately big JSON, resulting JSON payload is ~67KB.
rawData := gzipPassThroughStruct{
Expand Down Expand Up @@ -91,3 +50,44 @@

return u
}

// gzipPassThroughContainer is wrapping gzip.JSONContainer and implements gzipPassThroughOutput.
type gzipPassThroughContainer struct {
Header string `header:"X-Header" json:"-"`
gzip.JSONContainer
}

func (dc gzipPassThroughContainer) gzipPassThroughStruct() gzipPassThroughStruct {
var p gzipPassThroughStruct

err := dc.UnpackJSON(&p)
if err != nil {
panic(err)
}

return p
}

type gzipPassThroughInput struct {
PlainStruct bool `query:"plainStruct" description:"Output plain structure instead of gzip container."`
CountItems bool `query:"countItems" description:"Invokes internal decoding of compressed data."`
}

// gzipPassThroughOutput defers data to an accessor function instead of using struct directly.
// This is necessary to allow containers that can data in binary wire-friendly format.
type gzipPassThroughOutput interface {
// Data should be accessed though an accessor to allow container interface.
gzipPassThroughStruct() gzipPassThroughStruct
}

// gzipPassThroughStruct represents the actual structure that is held in the container
// and implements gzipPassThroughOutput to be directly useful in output.
type gzipPassThroughStruct struct {
Header string `header:"X-Header" json:"-"`
ID int `json:"id"`
Text []string `json:"text"`
}

func (d gzipPassThroughStruct) gzipPassThroughStruct() gzipPassThroughStruct {
return d
}
Loading
Loading