Open
Description
Describe the bug
required
field of definitions are not being respected while generating types
To Reproduce
Steps to reproduce the behavior:
npm i -g openapi-to-graphql-cli
openapi-to-graphql file.yaml
--> file.yaml is as pasted below
swagger: "2.0"
info:
version: 1.1.0
title: Test server
basePath: /api/v1
host: localhost
paths:
/user/{id}:
get:
operationId: getUserId
tags:
- users
produces:
- application/json
parameters:
- name: id
in: path
description: User Id
required: true
type: integer
format: int64
responses:
200:
description: A User Response
schema:
$ref: "#/definitions/UserResponse"
definitions:
UserResponse:
type: object
required:
- userId
properties:
userId:
type: integer
format: int64
userName:
type: string
Expected behavior
"""The start of any query"""
type Query {
userResponse(
"""User Id"""
id: Float!
): UserResponse
}
type UserResponse {
userId: Float! <-----
userName: String
}
instead of
"""The start of any query"""
type Query {
userResponse(
"""User Id"""
id: Float!
): UserResponse
}
type UserResponse {
userId: Float
userName: String
}