Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 19 2015 18:21

    casualjim on master

    fixes #169 no pointing to inter… (compare)

  • Dec 19 2015 18:21
    casualjim closed #169
  • Dec 19 2015 04:38

    casualjim on master

    add drone yml build (compare)

  • Dec 18 2015 06:41

    casualjim on master

    remove godep for gvt (compare)

  • Dec 16 2015 22:36
    casualjim commented #153
  • Dec 16 2015 22:36
    casualjim closed #153
  • Dec 16 2015 21:47
    casualjim commented #173
  • Dec 16 2015 21:46

    casualjim on master

    Add default value support for r… Merge pull request #173 from al… (compare)

  • Dec 16 2015 21:46
    casualjim closed #172
  • Dec 16 2015 21:46
    casualjim closed #173
  • Dec 16 2015 21:28
    aleksandr-vin opened #173
  • Dec 16 2015 21:21
    aleksandr-vin opened #172
  • Dec 16 2015 21:15
    johnpduffield opened #171
  • Dec 16 2015 17:16
    casualjim opened #170
  • Dec 15 2015 17:55

    casualjim on master

    rebuilding site Tue Dec 15 09:5… (compare)

  • Dec 15 2015 00:33
    casualjim labeled #169
  • Dec 15 2015 00:08
    ecnahc515 opened #169
  • Dec 14 2015 21:42

    casualjim on master

    rebuilding site Mon Dec 14 13:4… (compare)

  • Dec 14 2015 21:39
    casualjim commented on c5bf47f
  • Dec 14 2015 21:37
    casualjim commented on c5bf47f
Ivan Porto Carrero
@casualjim
or don’t share by default
anyway it’s a good point and I want to learn more about the specific implications of each approach
Chakrit Wichian
@chakrit
well yeah, keep up the good work btw : )
it’s a huge lib
Ivan Porto Carrero
@casualjim
yeah I thoroughly underestimated the complexity of swagger 2.0
if I would have known how much work it was going to be I would probably never have started
Chakrit Wichian
@chakrit
hmm that SO post about slice is interesting though, I’ll think about it more also.
Chakrit Wichian
@chakrit
@casualjim I just tried a clean build and noticed that the main operations file (restapi/operations/example_operations.go) are not generated for my main spec.
any idea what might be causing this?
sorry that should be restapi/operations/NAME_api.go the file is just missing
ah nailed down the operation
Commenting this out from the spec fixes it:
'/_debug':                                       
  get:                                           
    tags: ['_debug']                             
    operationId: 'getDebug'                      
    summary: 'Debug route strictly for testing.' 
    responses:                                   
      '200':                                     
        description: 'Debug result.'             
        schema: { type: 'any' }
Chakrit Wichian
@chakrit
seems the schema: { type: ‘any’ } is where it chokes on
Chakrit Wichian
@chakrit
Ugh seems I was a bit too trigger happy on the first try. Seems allOf for combining model definitions also doesn’t work now?
Ivan Porto Carrero
@casualjim
type: any is not supporte
it’s not supported by the swagger spec
it’s valid json schema but the swagger people chose to not allow it
@chakrit but allOf should be very much supported
i have tons of tests on that
anyOf is not supported for codegen at this moment though
as discussed in #41
Donald Hoelle
@dhoelle
@casualjim this project is amazing, thank you!
with respect to inheritance and polymorphism: how does the generated server code represent models composed with discriminators and allOf?
Donald Hoelle
@dhoelle
I tried generating a server using the models from the Models with Polymorphism Support example, which uses Pet as a parent interface for Cat and Dog. Both Cat and Dog contain properties inherited from Pet, as well as their own unique properties. The models for Cat and Dog seem to be empty structs (type Cat struct {}). Is that expected?
Apologies if that is a noob question.
Ivan Porto Carrero
@casualjim
@dhoelle that’s not right, it should do that. Not sure how it would do the discriminator thing though but the allOf stuff should work
thanks for letting me know :)
go-swagger/go-swagger#65
Donald Hoelle
@dhoelle

If I'm understanding the swagger spec correctly, a path supporting a schema with a discriminator would support operations using any schema which inherits the top-level schema.

So, in the example above, a POST to /pets that accepts schema of type Pet would also accept a post matching a Cat schema like { "petType": "Cat", "name":"Meow", "huntingSkill": "lazy" }

Ivan Porto Carrero
@casualjim
yeah but it will require a discriminator aware serializer
i’ll be back in 10 minutes, quick meeting here at work
Donald Hoelle
@dhoelle
From a Go programmatic perspective, I would imagine that a handling function for a path like that would need to use an interface. Something like:
type iPet interface {}
type Pet struct { petName, name string }
type Cat struct { Pet, huntingLevel string }
type Dog struct { Pet, packSize int }

type AddPetParams struct {
    // Pet to add to the store
    Pet iPet
}

func (fn AddPetHandlerFunc) Handle(params AddPetParams) (*iPet, error) {
    return fn(params)
}

// Actual handler
func addPet(params AddPetParams) (*iPet, error) {
   switch params.Pet.(type) {
      case Cat:
         // handle cat
      case Dog:
         // handle Dog
      case Pet:
         // handle untyped Pet
      default:
         return nil, fmt.Errorf("not a known pet; this should be captured by validation?")
   }
}
Ivan Porto Carrero
@casualjim
yeah something like that for sure
you don’t strictly require the iPet thing but yes I think you’re on the right track there
and the code generator needs to do this as deser/ser time
Donald Hoelle
@dhoelle
yeah, defining iPet was for illustration :)
I have very little experience in this space, but let me know if I can help!
Ivan Porto Carrero
@casualjim
submitting issues and hightlighting problems is a great start
Ivan Porto Carrero
@casualjim
@/all I’m moving this to slack, I’m getting more time to spend on this project in the next few weeks, and I want to reduce the amount of chat clients I have to deal with. You can join the slack room here: https://slackin.goswagger.io/
Ivan Porto Carrero
@casualjim
there is something wrong with the gitter client on linux for example, it uses tons of resources for some reason
Matthew Campbell
@mattkanwisher
@casualjim a dedicated slack for one project is a bit obscene I would suggest if you want people to join just make a channel on the primary GO slack http://blog.gopheracademy.com/gophers-slack-community/
Ivan Porto Carrero
@casualjim
even better :)
created a #go-swagger channel there
I can’t add integrations then like circle ci notifications
Art Ianuzzi
@ianuzzi
Sorry for a silly question, but I'm just getting started with the examples and I'm trying to add a method to a URL, but I get the Schema error at paths['/example'].put should be object error and I can not seem to figure out what I'm doing wrong.
paths:
  /example:
    # In this operation we do not apply the security, because it was applied globally above.
    # The security will be applied to this operation for that reason.
    get:
      summary: Server example operation
      description: This is an example opeartion to show how security is applied to the call.
      responses:
        200:
          description: OK
    put:
      responses:
        200:
          description: My cool new method
Ivan Porto Carrero
@casualjim
can you parse it with a yaml parser?
Art Ianuzzi
@ianuzzi
Sorry guys, it was the app at swaggerhub. Makrup was fine, there's a glitch in their app - if I do the markup in an editor and copy it in, save and refresh, it's fine.
kaaljabr
@kaaljabr

What should be Accept-language in the header defined as in swagger yaml file:

 - name: Accept-Language
          in: header

Should it be type: array? or string?

Daniel I. Khan Ramiro
@dikhan
Hi folks, just joined gitter and this channel. I have been working on a terraform plugin that configures itself at runtime based on an OpenAPI 2.0 spec and figured it might be of interest to some of the audience here...I was wondering if it'd be fine to share the repo link here, wasn't sure about the channel policies so wanted to ask first :)