Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
private/apigen: Panic types defined in main package
The API generator was generating invalid code when types were defined in a main package because the generated Go code was defining in import from it. This commit update the Go generator to panic with a explicit error message if that situation happens. The commit also add a new endpoint to the example with a named types (i.e. no anonymous) to show that the Generator works fine with them. Change-Id: Ieddd89c67048de50516f7ac7787d602660dc4a54
- Loading branch information
1 parent
7ab7ac4
commit 48d7be7
Showing
7 changed files
with
123 additions
and
1 deletion.
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
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,19 @@ | ||
// Copyright (C) 2023 Storj Labs, Inc. | ||
// See LICENSE for copying information. | ||
|
||
package myapi | ||
|
||
import ( | ||
"time" | ||
|
||
"storj.io/common/uuid" | ||
) | ||
|
||
// Document is a retrieved document. | ||
type Document struct { | ||
ID uuid.UUID `json:"id"` | ||
Date time.Time `json:"date"` | ||
PathParam string `json:"pathParam"` | ||
Body string `json:"body"` | ||
Version uint `json:"version"` | ||
} |
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