Comments (7)
I think I'm also experiencing the same on v2.1, running the codegen a dozen times produces 2 or 3 distinct diffs. In each case the base64 data in var swaggerSpec = []string{
is slightly different.
I'm working on a minimal spec to reproduce.
from oapi-codegen.
The spec in https://github.com/percivalalb/oapi-codegen-issue-1572 reproduces this issue
from oapi-codegen.
Interesting 🤔 are you able to share what the diff is when generation fails? Is it that there's subtle differences in the generated spec?
from oapi-codegen.
Thanks so much @percivalalb 🙌
Via our very new contribution guideline, mind also sticking an Apache-2..0 license on that repo?
from oapi-codegen.
Thanks so much @percivalalb 🙌
Via our very new contribution guideline, mind also sticking an Apache-2..0 license on that repo?
Sure - done
from oapi-codegen.
Interesting 🤔 are you able to share what the diff is when generation fails? Is it that there's subtle differences in the generated spec?
I can't share the diff (internal proprietary stuff), but I can characterize it. In the bad generation, I'm generally seeing the externally referenced schema having come over, but any other schemas it referenced within that external file are missing.
Unlike Percival's sample, I'm seeing the bad result being the same each time, at least out of 3 failing runs, after normalizing away any document ordering differences via VSCode's JSON: Sort document
command.
from oapi-codegen.
Thanks! I can also see this in #1481 which has the two specs:
{"components":{"schemas":{"Category":{"properties":{"id":{"example":1,"format":"int64","type":"integer"},"name":{"example":"Dogs","type":"string"}},"type":"object","xml":{"name":"category"}},"Container":{"properties":{"object_a":{"$ref":"#/components/schemas/ObjectA"},"object_b":{"$ref":"#/components/schemas/ObjectB"},"object_c":{"$ref":"#/components/schemas/object_c"},"pet":{"$ref":"#/components/schemas/Pet"}}},"ObjectA":{"properties":{"name":{"type":"string"},"object_b":{"$ref":"#/components/schemas/ObjectB"}}},"ObjectB":{"properties":{"name":{"type":"string"}}},"Pet":{"properties":{"category":{"$ref":"#/components/schemas/Category"},"id":{"example":10,"format":"int64","type":"integer"},"name":{"example":"doggie","type":"string"},"photoUrls":{"items":{"type":"string","xml":{"name":"photoUrl"}},"type":"array","xml":{"wrapped":true}},"status":{"description":"pet status in the store","enum":["available","pending","sold"],"type":"string"},"tags":{"items":{"$ref":"#/components/schemas/Tag"},"type":"array","xml":{"wrapped":true}}},"required":["name","photoUrls"],"type":"object","xml":{"name":"pet"}},"Tag":{"properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"}},"type":"object","xml":{"name":"tag"}},"object_c":{"additionalProperties":true,"type":"object"}}},"info":{"title":"","version":""},"openapi":"3.0.0","paths":{}}
{"components":{"schemas":{"Category":{"properties":{"id":{"properties":{"id":{"example":1,"format":"int64","type":"integer"},"name":{"example":"Dogs","type":"string"}},"type":"object","xml":{"name":"category"}},"name":{"properties":{"id":{"example":1,"format":"int64","type":"integer"},"name":{"example":"Dogs","type":"string"}},"type":"object","xml":{"name":"category"}}},"type":"object","xml":{"name":"category"}},"Container":{"properties":{"object_a":{"$ref":"#/components/schemas/ObjectA"},"object_b":{"$ref":"#/components/schemas/ObjectB"},"object_c":{"$ref":"#/components/schemas/object_c"},"pet":{"$ref":"#/components/schemas/Pet"}}},"ObjectA":{"properties":{"name":{"type":"string"},"object_b":{"$ref":"#/components/schemas/ObjectB"}}},"ObjectB":{"properties":{"name":{"type":"string"}}},"Pet":{"properties":{"category":{"properties":{"category":{"$ref":"#/components/schemas/Category"},"id":{"example":10,"format":"int64","type":"integer"},"name":{"example":"doggie","type":"string"},"photoUrls":{"items":{"type":"string","xml":{"name":"photoUrl"}},"type":"array","xml":{"wrapped":true}},"status":{"description":"pet status in the store","enum":["available","pending","sold"],"type":"string"},"tags":{"items":{"$ref":"#/components/schemas/Tag"},"type":"array","xml":{"wrapped":true}}},"required":["name","photoUrls"],"type":"object","xml":{"name":"pet"}},"id":{"properties":{"category":{"$ref":"#/components/schemas/Category"},"id":{"example":10,"format":"int64","type":"integer"},"name":{"example":"doggie","type":"string"},"photoUrls":{"items":{"type":"string","xml":{"name":"photoUrl"}},"type":"array","xml":{"wrapped":true}},"status":{"description":"pet status in the store","enum":["available","pending","sold"],"type":"string"},"tags":{"items":{"$ref":"#/components/schemas/Tag"},"type":"array","xml":{"wrapped":true}}},"required":["name","photoUrls"],"type":"object","xml":{"name":"pet"}},"name":{"properties":{"category":{"$ref":"#/components/schemas/Category"},"id":{"example":10,"format":"int64","type":"integer"},"name":{"example":"doggie","type":"string"},"photoUrls":{"items":{"type":"string","xml":{"name":"photoUrl"}},"type":"array","xml":{"wrapped":true}},"status":{"description":"pet status in the store","enum":["available","pending","sold"],"type":"string"},"tags":{"items":{"$ref":"#/components/schemas/Tag"},"type":"array","xml":{"wrapped":true}}},"required":["name","photoUrls"],"type":"object","xml":{"name":"pet"}},"photoUrls":{"properties":{"category":{"$ref":"#/components/schemas/Category"},"id":{"example":10,"format":"int64","type":"integer"},"name":{"example":"doggie","type":"string"},"photoUrls":{"items":{"type":"string","xml":{"name":"photoUrl"}},"type":"array","xml":{"wrapped":true}},"status":{"description":"pet status in the store","enum":["available","pending","sold"],"type":"string"},"tags":{"items":{"$ref":"#/components/schemas/Tag"},"type":"array","xml":{"wrapped":true}}},"required":["name","photoUrls"],"type":"object","xml":{"name":"pet"}},"status":{"properties":{"category":{"$ref":"#/components/schemas/Category"},"id":{"example":10,"format":"int64","type":"integer"},"name":{"example":"doggie","type":"string"},"photoUrls":{"items":{"type":"string","xml":{"name":"photoUrl"}},"type":"array","xml":{"wrapped":true}},"status":{"description":"pet status in the store","enum":["available","pending","sold"],"type":"string"},"tags":{"items":{"$ref":"#/components/schemas/Tag"},"type":"array","xml":{"wrapped":true}}},"required":["name","photoUrls"],"type":"object","xml":{"name":"pet"}},"tags":{"properties":{"category":{"$ref":"#/components/schemas/Category"},"id":{"example":10,"format":"int64","type":"integer"},"name":{"example":"doggie","type":"string"},"photoUrls":{"items":{"type":"string","xml":{"name":"photoUrl"}},"type":"array","xml":{"wrapped":true}},"status":{"description":"pet status in the store","enum":["available","pending","sold"],"type":"string"},"tags":{"items":{"$ref":"#/components/schemas/Tag"},"type":"array","xml":{"wrapped":true}}},"required":["name","photoUrls"],"type":"object","xml":{"name":"pet"}}},"required":["name","photoUrls"],"type":"object","xml":{"name":"pet"}},"Tag":{"properties":{"id":{"properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"}},"type":"object","xml":{"name":"tag"}},"name":{"properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"}},"type":"object","xml":{"name":"tag"}}},"type":"object","xml":{"name":"tag"}},"object_c":{"additionalProperties":true,"type":"object"}}},"info":{"title":"","version":""},"openapi":"3.0.0","paths":{}}
from oapi-codegen.
Related Issues (20)
- Make `stdhttp` the default generated type
- Document exploded form params
- fix: return an error when `client` is called but `models` isn't used
- docs: document supported `format`s i.e. for `type: string`
- chore: log when overriding types in an `allOf` HOT 1
- docs(FAQ): "how can I use an unsupported, but `net/http` compliant library?"
- docs: supported version matrix
- Generator confused by duplicated path parameter HOT 3
- Slice type marshal error
- bug: strict server interface doesn't marshal additionalProperties in complex object
- cannot generate split files with schema only HOT 4
- http strict request bodies should be optional by default HOT 2
- docs(contributing): when will we add new linting rules?
- docs(contributing): document when JSON schema changes needed
- docs: missing description for `compatibility` in JSON Schema
- feat: add an `engine` or `openapi-library` configuration item
- feat: provide a complex `overrides` configuration HOT 1
- feat: unique (+ more verbose) generated names
- feat(JSON Schema): improve validation to indicate that `strict-server` is required with a server
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oapi-codegen.