Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #1561
Closed
Open
Issue created Nov 27, 2018 by Administrator@rootContributor

[typescript-fetch] (4.0.X) format: date parameters should not include time component

Created by: someone1

Description

Currently, when a request is generated via the typescript-fetch client, type: string/format:date parameters include a time component when it should not.

openapi-generator version

openapi-generator-cli-4.0.0-20181126.024631-44

OpenAPI declaration file content or url
swagger: "2.0"
info:
  title: "Simple Test"

paths:
  "/get/Simple":
    get:
      summary: Retrieve List of Simple
      operationId: "get.Simple"
      responses:
        200:
          description: OK
          schema:
            $ref: "#/definitions/Simple"

definitions:         
  Simple:
    type: object
    required:
      - Name
    properties:
      Date:
        type: string
        format: date

Output:

import { exists } from '../runtime';
/**
 * 
 * @export
 * @interface Simple
 */
export interface Simple {
    /**
     * 
     * @type {Date}
     * @memberof Simple
     */
    date?: Date;
}

export function SimpleFromJSON(json: any): Simple {
    return {
        'date': !exists(json, 'Date') ? undefined : new Date(json['Date']),
    };
}

export function SimpleToJSON(value?: Simple): any {
    if (value === undefined) {
        return undefined;
    }
    return {
        'Date': value.date === undefined ? undefined : value.date.toISOString(),
    };
}
Command line used for generation

openapi-generator generate -i openapi.yaml -l typescript-fetch -c es6.json -o ./typescript-api/

Steps to reproduce
  1. Use the provided yaml excerpt above to generate a client with the provided command line
  2. Buggy code generated
Related issues/PRs

PR #569

Suggest a fix/enhancement

Update template to take substring of ISO date to only include the date portion when format: date

Assignee
Assign to
Time tracking