Giter Club home page Giter Club logo

Comments (7)

IGassmann avatar IGassmann commented on August 23, 2024

Same problem for https://github.com/ory/sdk/blob/master/clients/hydra/typescript/model/consentRequest.ts#L27

The issue seems for when we can pass custom objects.

from sdk.

aeneasr avatar aeneasr commented on August 23, 2024

Hm yeah, that's true. The definition comes from here:

https://github.com/ory/hydra/blob/master/consent/types.go#L543

which is translated to:

https://github.com/ory/hydra/blob/master/.schema/api.swagger.json#L2095-L2101

I think type object is correct but I'm not sure why additionalProperties is added there and if that's causing the issue?

from sdk.

aeneasr avatar aeneasr commented on August 23, 2024

Could you try and generate the typescript code and take the linked swagger.json and update the additionalProperties part? If that's causing the issue I guess we could open an issue in openapi-generator

from sdk.

aeneasr avatar aeneasr commented on August 23, 2024

There's actually a new version available for openapi-generator so maybe it would be a good idea to bump it as it includes several bugfixes for TypeScript. It would also make sense to tag the version:

https://github.com/ory/sdk/blob/master/Dockerfile#L71

from sdk.

IGassmann avatar IGassmann commented on August 23, 2024

I haven't tested, but it looks like the generated OpenAPI specification should actually be the following according to https://swagger.io/docs/specification/data-models/dictionaries/.

type: object
additionalProperties:
  type: string

If that's true, that indicates the problem resides in the tool being used for generating the OpenAPI specification.

from sdk.

aeneasr avatar aeneasr commented on August 23, 2024

Found the upstream: go-swagger/go-swagger#1402

from sdk.

matejkramny avatar matejkramny commented on August 23, 2024

I think this issue came back but for the Go client this time

If in the openapi spec I remove the additionalProperties: true comment the generator produces the correct type

The sanitizer could remove the additionalProperties field for swagger specs https://github.com/ory/cli/blob/master/cmd/dev/swagger/sanitize.go#L96

spec from pet store

"Pet": {
        "description": "A pet for sale in the pet store",
        "title": "a Pet",
        "type": "object",
        "properties": {
          "access_token": {
            "type": "object",
            "x-go-name": "AccessToken"
          },
          "id_token": {
            "type": "object",
            "additionalProperties": {
              "type": "object"
            },
            "x-go-name": "IDToken"
          }
        },
        "xml": {
          "name": "Pet"
        }
      },
// Pet A pet for sale in the pet store
type Pet struct {
	AccessToken map[string]interface{}            `json:"access_token,omitempty"`
	IdToken     map[string]map[string]interface{} `json:"id_token,omitempty"`
}

Hydra issue related: ory/hydra#3058

from sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.