Skip to content

[BUG] Description #23897

@JacobDel

Description

@JacobDel

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

UUID is not imported

openapi-generator version
OpenAPI declaration file content or url
Generation Details
from datetime import date, datetime  # noqa: F401

from typing import List, Dict  # noqa: F401

from flask_server_stub.openapi_server.models.base_model import Model
import re
from flask_server_stub.openapi_server import util

import re  # noqa: E501

class Pushnotification(Model):
    """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

    Do not edit the class manually.
    """

    def __init__(self, id=None, time=None):  # noqa: E501
        """Pushnotification - a model defined in OpenAPI

        :param id: The id of this Pushnotification.  # noqa: E501
        :type id: UUID
        :param time: The time of this Pushnotification.  # noqa: E501
        :type time: str
        """
        self.openapi_types = {
            'id': UUID,
            'time': str
        }

        self.attribute_map = {
            'id': 'id',
            'time': 'time'
        }

        self._id = id
        self._time = time

    @classmethod
    def from_dict(cls, dikt) -> 'Pushnotification':
        """Returns the dict as a model

        :param dikt: A dict.
        :type: dict
        :return: The Pushnotification of this Pushnotification.  # noqa: E501
        :rtype: Pushnotification
        """
        return util.deserialize_model(dikt, cls)

    @property
    def id(self) -> UUID:
        """Gets the id of this Pushnotification.

          # noqa: E501

        :return: The id of this Pushnotification.
        :rtype: UUID
        """
        return self._id

    @id.setter
    def id(self, id: UUID):
        """Sets the id of this Pushnotification.

          # noqa: E501

        :param id: The id of this Pushnotification.
        :type id: UUID
        """
        if id is None:
            raise ValueError("Invalid value for `id`, must not be `None`")  # noqa: E501
        if id is not None and len(id) < 32:
            raise ValueError("Invalid value for `id`, length must be greater than or equal to `32`")  # noqa: E501
        if id is not None and not re.search(r'\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b', id):  # noqa: E501
            raise ValueError(r"Invalid value for `id`, must be a follow pattern or equal to `/\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b/`")  # noqa: E501

        self._id = id

    @property
    def time(self) -> str:
        """Gets the time of this Pushnotification.

        because openapi datetime is buggy & bad  # noqa: E501

        :return: The time of this Pushnotification.
        :rtype: str
        """
        return self._time

    @time.setter
    def time(self, time: str):
        """Sets the time of this Pushnotification.

        because openapi datetime is buggy & bad  # noqa: E501

        :param time: The time of this Pushnotification.
        :type time: str
        """
        if time is None:
            raise ValueError("Invalid value for `time`, must not be `None`")  # noqa: E501
        if time is not None and not re.search(r'^([0-9]{1,2}):([0-9]{2})', time):  # noqa: E501
            raise ValueError(r"Invalid value for `time`, must be a follow pattern or equal to `/^([0-9]{1,2}):([0-9]{2})/`")  # noqa: E501

        self._time = time
Steps to reproduce

generate flask server stub

Related issues/PRs
Suggest a fix

Import UUID

Dirty fix

remove uuid from format:

components:
  schemas:
    uuid:
      type: string
      title: uuid
      pattern: '\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b'
      x-examples:
        example-1: 497f6eca-6276-4993-bfeb-53cbbbba6f08
      example: 556cf523-c494-41b1-b397-b5f02684acbb
      minLength: 32

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions