Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Bug with "format: date-time" #161

Open
SOHELAHMED7/yii2-openapi
#38
@siggi-k

Description

@siggi-k

Initial

schema.yaml

openapi: 3.0.3
# Edit this schema and start your project
# This is sample schema
# To generate code which is based on this schema
# run commands mentioned Development section in README.md file
info:
  title: 'Proxy-Service'
  description: ""
  version: 1.0.0
  contact:
    name: '...'
    email: you@example.com
servers:
  - url: 'http://localhost:9937'
    description: 'Local Dev API'
security:
  - BasicAuth: []
components:
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
  schemas:

    Subscription:
      type: object
      required:
        - id
      properties:
        id:
          type: integer
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
          readOnly: True
        updatedAt:
          type: string
          format: date-time
          readOnly: true

Reproduction steps

./yii gii/api
./yii migrate

#again
./yii gii/api

Expected
No more migration

Result

<?php

/**
 * Table for Subscription
 */
class m240205_140005_change_table_subscriptions extends \yii\db\Migration
{
    public function up()
    {
        $this->alterColumn('{{%subscriptions}}', 'start', $this->timestamp()->null()->defaultValue(null));
        $this->alterColumn('{{%subscriptions}}', 'end', $this->timestamp()->null()->defaultValue(null));
        $this->alterColumn('{{%subscriptions}}', 'createdAt', $this->timestamp()->null()->defaultValue(null));
        $this->alterColumn('{{%subscriptions}}', 'updatedAt', $this->timestamp()->null()->defaultValue(null));
    }

    public function down()
    {
        $this->alterColumn('{{%subscriptions}}', 'updatedAt', $this->timestamp()->null()->defaultValue(null));
        $this->alterColumn('{{%subscriptions}}', 'createdAt', $this->timestamp()->null()->defaultValue(null));
        $this->alterColumn('{{%subscriptions}}', 'end', $this->timestamp()->null()->defaultValue(null));
        $this->alterColumn('{{%subscriptions}}', 'start', $this->timestamp()->null()->defaultValue(null));
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions