Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nullable: trueの時にnullableにならない #82

Closed
1 of 3 tasks
redshoga opened this issue Nov 25, 2020 · 1 comment
Closed
1 of 3 tasks

nullable: trueの時にnullableにならない #82

redshoga opened this issue Nov 25, 2020 · 1 comment

Comments

@redshoga
Copy link
Contributor

redshoga commented Nov 25, 2020

Description

OAS上でnullableを指定しても出力されるコードがnull許容にならないです。

Environment

  • Package version: 0.13.0
  • OS:
    • Linux
    • Windows
    • macOS
  • Node.js version: v12.18.0
  • npm version: 6.14.4

Additional context

再現

aspida.config.js

module.exports = {
  input: "api",
  outputEachDir: true,
  openapi: { inputFile: "./sample.yml" }
}

sample.yml

openapi: 3.0.0
info:
  title: sample-title
  description: sample-description
  version: 0.1.0
paths:
  /v1/sample:
    get:
      parameters:
        - in: query
          name: required_query
          required: true
          schema:
            type: string
        - in: query
          name: not_required_query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: sample response description
          content:
            application/json:
              schema:
                type: object
                properties:
                  sampleKey1:
                    type: string
                  sampleKey2:
                    type: string
                    nullable: true

実行

出力結果

/* eslint-disable */
export type Methods = {
  get: {
    query?: {
      required_query: string
      not_required_query?: string
    }

    status: 200

    resBody: {
      sampleKey1: string
      sampleKey2: string
    }
  }
}

期待する出力

/* eslint-disable */
export type Methods = {
  get: {
    query?: {
      required_query: string
      not_required_query?: string
    }

    status: 200

    resBody: {
      sampleKey1: string
      sampleKey2: string | null
    }
  }
}

補足

#71 を起票した者です。
v0.13の対応ありがとうございました。よりこうであったら良いと思ったのでIssueを作成しました🙇

@solufa solufa mentioned this issue Nov 25, 2020
9 tasks
@solufa
Copy link
Member

solufa commented Nov 25, 2020

投稿ありがとうございます

nullable対応したのでご確認ください

@solufa solufa closed this as completed Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants