| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I am very interested to try it, when it is finished, as I think it is solving a similar issue I am experiencing... 👍 |
Sorry, something went wrong.
|
Hi guys, I was wondering if there was any update on that issue ? |
Sorry, something went wrong.
|
@deepmap-marcinr I think I may need a hand with the PascalSchema error, currently trying to work out the intent of those tests to work out what handling needs to be added |
Sorry, something went wrong.
|
I've got this working finally 👏 If you're happy with it, @deepmap-marcinr, I'll sort out the Git history then merge it. I'll test it out with a few other specs that have been mentioned to be affected, too |
Sorry, something went wrong.
|
Got a couple of tweaks to make:
|
Sorry, something went wrong.
rew! handle absent content/mediaType
As part of future changes we need to be able to reference all the types in the defined `responses` of a specification. However, as we're currently only rendering `application/json` media types, this fails. Instead, we can generate `json.RawMessage` (which is an alias of `[]byte`) for these types, which allow referencing them, and (un)marshaling data to the types.
As part of future changes we need to be able to reference all the types in the defined `requestBodies` of a specification. However, as we're currently only rendering `application/json` media types, this fails. Instead, we can generate `json.RawMessage` (which is an alias of `[]byte`) for these types, which allow referencing them, and (un)marshaling data to the types.
Previously, there was no way to render any anonymous types that are referenced in the `paths` of an OpenAPI specification. Although there is a strong preference in the community to use the `/components/schemas/`, there are times that it's out of our control to move objects around. This generates both the `requestBody` and `responses`. TODO Closes 626 TODO
| } else { | ||
| typeName += ToCamelCase(strings.ToLower(operationName)) + ToCamelCase(pathName) | ||
| } | ||
| typeName += fmt.Sprintf("ResponseBody%s", ToCamelCase(statusCodeOrDefault)) |
There was a problem hiding this comment.
Is this sufficient to avoid type conflict? What if a request has two response bodies with different content types for the same response code? What happens in that case?
Sorry, something went wrong.
There was a problem hiding this comment.
In that case, yep, it'll handle the conflict well enough
i.e.:
// NewPetResponseBody200ApplicationYaml defines model for the response body for POST /pets (200, application/yaml).
type NewPetResponseBody200ApplicationYaml = map[string]interface{}
// NewPetResponseBody200TextPlain defines model for the response body for POST /pets (200, text/plain).
type NewPetResponseBody200TextPlain = map[string]interface{}
Sorry, something went wrong.
|
Bump |
Sorry, something went wrong.
|
Is there any updated on this? Simplifying the issue, we have this generated code: type MyBucket struct {
Spec *struct {
ArchivePeriod *BucketSpecArchivePeriod `json:"archivePeriod,omitempty"`
Cors *struct {
...
}
// other fields
}
when running go generated ./generated we get the following error: └─( go generate ./generated
command-line-arguments:-: name requested for invalid type: struct{Cors *struct{MaxAgeSeconds *float32 "json:\"maxAgeSeconds,omitempty\""; Methods *[]string "json:\"methods,omitempty\""; Origins *[]string "json:\"origins,omitempty\""; ResponseHeaders *[]string "json:\"responseHeaders,omitempty\""} "json:\"cors,omitempty\""; Status *struct{FromProvider *map[string]interface{} "json:\"fromProvider,omitempty\""} "json:\"status,omitempty\""}
Error: not all generators ran successfully
run `controller-gen object paths=types.gen.go -w` to see all available markers, or `controller-gen object paths=types.gen.go -h` for usage
generated/types.gen.go:6: running "controller-gen": exit status 1
By trying a few different combinations, it appears that the anonymoust structs are the cause of the error. |
Sorry, something went wrong.
|
Another bump for this. |
Sorry, something went wrong.
|
Hey @jamietanna do you have any news for this feature ? We would benefit a lot from this and would like to see it merge. Do you have any blockers ? Cheers |
Sorry, something went wrong.
Main blocker is time to be honest 😅 As noted in #1606 the project would appreciate sponsors to help with dedicating time to the project's maintenance, and if the company you're working at would benefit from this, I'd appreciate sponsorship to help the work along I've got quite a few things to do before v2.5.0 and an ever growing backlog, on top of long standing issues like this that would benefit many users |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Closes #626, #636.