Code Monkey home page Code Monkey logo

Comments (7)

justinyoo avatar justinyoo commented on June 5, 2024 2

@ChristianWeyer This has been fixed and released to 1.5.2

from azurefunctions.extensions.

justinyoo avatar justinyoo commented on June 5, 2024 1

@ChristianWeyer Thanks for raising this issue! I'll have a look and get back to you.

from azurefunctions.extensions.

hf-kklein avatar hf-kklein commented on June 5, 2024 1

The problem also applies for list types in the OpenApiRequestBody.
@ChristianWeyer I'd suggest to change the title of this issue to 'Type List for OpenApiPayloadAttribute not mapped correctly'.

from azurefunctions.extensions.

justinyoo avatar justinyoo commented on June 5, 2024

from azurefunctions.extensions.

hf-kklein avatar hf-kklein commented on June 5, 2024

I’ve excluded JObject and Dictionary<> from being a root level payload type, at #29. I think so does the List<>, too.

By saying so, do you consider this issue as a missing feature/bug or being out of scope?

IMHO returning list types is a valid use case and the generated OpenApi.json should render somehow like

"content": {
    "application/json": {
      "schema": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Product"
        }
      }
    }

and include a schema derived from class Product.

from azurefunctions.extensions.

glennular avatar glennular commented on June 5, 2024

The support for List<> is part of #37.

from azurefunctions.extensions.

ChristianWeyer avatar ChristianWeyer commented on June 5, 2024

Sorry, this does not yet seem to work?

I am using 1.5.2 now.
The Swagger JSON now looks like this:

{
  "swagger": "2.0",
  "info": { },
  "host": "localhost:7071",
  "schemes": [
    "http"
  ],
  "paths": {
    "/api/products": {
      "get": {
        "tags": [
          "Serverless Microservices"
        ],
        "operationId": "products",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "Payload of Array of Product",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Product"
              }
            }
          }
        }
      }
    },
    "/api/products/{id}": {
      "get": {
        "tags": [
          "Serverless Microservices"
        ],
        "operationId": "productbyid",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "Payload of ProductDetails",
            "schema": {
              "$ref": "#/definitions/ProductDetails"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "ProductDetails": {
      "type": "object",
      "properties": {
        "Id": {
          "format": "uuid",
          "type": "string"
        },
        "Name": {
          "type": "string"
        },
        "Description": {
          "type": "string"
        },
        "OnStock": {
          "type": "boolean"
        }
      }
    }
  },
  "securityDefinitions": {
    "authKey": {
      "type": "apiKey",
      "name": "x-functions-key",
      "in": "header"
    }
  }
}

As you can see, there is no definition for Product in there.
This seems to be missing - and thus the UI breaks as well:

image

Any idea what could be wrong here? @justinyoo @glennular
Thanks!

from azurefunctions.extensions.

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.