forked from loafle/openapi-generator-original
		
	[Crystal] add require "big" for decimal (#13696)
				
					
				
			* add require big, add tests * add new files
This commit is contained in:
		
							parent
							
								
									506ca21782
								
							
						
					
					
						commit
						8548a63d96
					
				@ -1,6 +1,6 @@
 | 
				
			|||||||
generatorName: crystal
 | 
					generatorName: crystal
 | 
				
			||||||
outputDir: samples/client/petstore/crystal
 | 
					outputDir: samples/client/petstore/crystal
 | 
				
			||||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
 | 
					inputSpec: modules/openapi-generator/src/test/resources/3_0/crystal/petstore.yaml
 | 
				
			||||||
templateDir: modules/openapi-generator/src/main/resources/crystal
 | 
					templateDir: modules/openapi-generator/src/main/resources/crystal
 | 
				
			||||||
additionalProperties:
 | 
					additionalProperties:
 | 
				
			||||||
  shardVersion: 1.0.0
 | 
					  shardVersion: 1.0.0
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
# {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}}
 | 
					# {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require "big"
 | 
				
			||||||
require "json"
 | 
					require "json"
 | 
				
			||||||
require "time"
 | 
					require "time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,811 @@
 | 
				
			|||||||
 | 
					openapi: 3.0.0
 | 
				
			||||||
 | 
					servers:
 | 
				
			||||||
 | 
					  - url: 'http://petstore.swagger.io/v2'
 | 
				
			||||||
 | 
					info:
 | 
				
			||||||
 | 
					  description: >-
 | 
				
			||||||
 | 
					    This is a sample server Petstore server. For this sample, you can use the api key
 | 
				
			||||||
 | 
					    `special-key` to test the authorization filters.
 | 
				
			||||||
 | 
					  version: 1.0.0
 | 
				
			||||||
 | 
					  title: OpenAPI Petstore
 | 
				
			||||||
 | 
					  license:
 | 
				
			||||||
 | 
					    name: Apache-2.0
 | 
				
			||||||
 | 
					    url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
 | 
				
			||||||
 | 
					tags:
 | 
				
			||||||
 | 
					  - name: pet
 | 
				
			||||||
 | 
					    description: Everything about your Pets
 | 
				
			||||||
 | 
					  - name: store
 | 
				
			||||||
 | 
					    description: Access to Petstore orders
 | 
				
			||||||
 | 
					  - name: user
 | 
				
			||||||
 | 
					    description: Operations about user
 | 
				
			||||||
 | 
					paths:
 | 
				
			||||||
 | 
					  /pet:
 | 
				
			||||||
 | 
					    post:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - pet
 | 
				
			||||||
 | 
					      summary: Add a new pet to the store
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: addPet
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/xml:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					        '405':
 | 
				
			||||||
 | 
					          description: Invalid input
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - petstore_auth:
 | 
				
			||||||
 | 
					            - 'write:pets'
 | 
				
			||||||
 | 
					            - 'read:pets'
 | 
				
			||||||
 | 
					      requestBody:
 | 
				
			||||||
 | 
					        $ref: '#/components/requestBodies/Pet'
 | 
				
			||||||
 | 
					    put:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - pet
 | 
				
			||||||
 | 
					      summary: Update an existing pet
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: updatePet
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/xml:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid ID supplied
 | 
				
			||||||
 | 
					        '404':
 | 
				
			||||||
 | 
					          description: Pet not found
 | 
				
			||||||
 | 
					        '405':
 | 
				
			||||||
 | 
					          description: Validation exception
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - petstore_auth:
 | 
				
			||||||
 | 
					            - 'write:pets'
 | 
				
			||||||
 | 
					            - 'read:pets'
 | 
				
			||||||
 | 
					      requestBody:
 | 
				
			||||||
 | 
					        $ref: '#/components/requestBodies/Pet'
 | 
				
			||||||
 | 
					  /pet/findByStatus:
 | 
				
			||||||
 | 
					    get:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - pet
 | 
				
			||||||
 | 
					      summary: Finds Pets by status
 | 
				
			||||||
 | 
					      description: Multiple status values can be provided with comma separated strings
 | 
				
			||||||
 | 
					      operationId: findPetsByStatus
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: status
 | 
				
			||||||
 | 
					          in: query
 | 
				
			||||||
 | 
					          description: Status values that need to be considered for filter
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          style: form
 | 
				
			||||||
 | 
					          explode: false
 | 
				
			||||||
 | 
					          deprecated: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: array
 | 
				
			||||||
 | 
					            items:
 | 
				
			||||||
 | 
					              type: string
 | 
				
			||||||
 | 
					              enum:
 | 
				
			||||||
 | 
					                - available
 | 
				
			||||||
 | 
					                - pending
 | 
				
			||||||
 | 
					                - sold
 | 
				
			||||||
 | 
					              default: available
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/xml:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: array
 | 
				
			||||||
 | 
					                items:
 | 
				
			||||||
 | 
					                  $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: array
 | 
				
			||||||
 | 
					                items:
 | 
				
			||||||
 | 
					                  $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid status value
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - petstore_auth:
 | 
				
			||||||
 | 
					            - 'read:pets'
 | 
				
			||||||
 | 
					  /pet/findByTags:
 | 
				
			||||||
 | 
					    get:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - pet
 | 
				
			||||||
 | 
					      summary: Finds Pets by tags
 | 
				
			||||||
 | 
					      description: >-
 | 
				
			||||||
 | 
					        Multiple tags can be provided with comma separated strings. Use tag1,
 | 
				
			||||||
 | 
					        tag2, tag3 for testing.
 | 
				
			||||||
 | 
					      operationId: findPetsByTags
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: tags
 | 
				
			||||||
 | 
					          in: query
 | 
				
			||||||
 | 
					          description: Tags to filter by
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          style: form
 | 
				
			||||||
 | 
					          explode: false
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: array
 | 
				
			||||||
 | 
					            items:
 | 
				
			||||||
 | 
					              type: string
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/xml:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: array
 | 
				
			||||||
 | 
					                items:
 | 
				
			||||||
 | 
					                  $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: array
 | 
				
			||||||
 | 
					                items:
 | 
				
			||||||
 | 
					                  $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid tag value
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - petstore_auth:
 | 
				
			||||||
 | 
					            - 'read:pets'
 | 
				
			||||||
 | 
					      deprecated: true
 | 
				
			||||||
 | 
					  '/pet/{petId}':
 | 
				
			||||||
 | 
					    get:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - pet
 | 
				
			||||||
 | 
					      summary: Find pet by ID
 | 
				
			||||||
 | 
					      description: Returns a single pet
 | 
				
			||||||
 | 
					      operationId: getPetById
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: petId
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: ID of pet to return
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: integer
 | 
				
			||||||
 | 
					            format: int64
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/xml:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid ID supplied
 | 
				
			||||||
 | 
					        '404':
 | 
				
			||||||
 | 
					          description: Pet not found
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - api_key: []
 | 
				
			||||||
 | 
					    post:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - pet
 | 
				
			||||||
 | 
					      summary: Updates a pet in the store with form data
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: updatePetWithForm
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: petId
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: ID of pet that needs to be updated
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: integer
 | 
				
			||||||
 | 
					            format: int64
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '405':
 | 
				
			||||||
 | 
					          description: Invalid input
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - petstore_auth:
 | 
				
			||||||
 | 
					            - 'write:pets'
 | 
				
			||||||
 | 
					            - 'read:pets'
 | 
				
			||||||
 | 
					      requestBody:
 | 
				
			||||||
 | 
					        content:
 | 
				
			||||||
 | 
					          application/x-www-form-urlencoded:
 | 
				
			||||||
 | 
					            schema:
 | 
				
			||||||
 | 
					              type: object
 | 
				
			||||||
 | 
					              properties:
 | 
				
			||||||
 | 
					                name:
 | 
				
			||||||
 | 
					                  description: Updated name of the pet
 | 
				
			||||||
 | 
					                  type: string
 | 
				
			||||||
 | 
					                status:
 | 
				
			||||||
 | 
					                  description: Updated status of the pet
 | 
				
			||||||
 | 
					                  type: string
 | 
				
			||||||
 | 
					    delete:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - pet
 | 
				
			||||||
 | 
					      summary: Deletes a pet
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: deletePet
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: api_key
 | 
				
			||||||
 | 
					          in: header
 | 
				
			||||||
 | 
					          required: false
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					        - name: petId
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: Pet id to delete
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: integer
 | 
				
			||||||
 | 
					            format: int64
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid pet value
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - petstore_auth:
 | 
				
			||||||
 | 
					            - 'write:pets'
 | 
				
			||||||
 | 
					            - 'read:pets'
 | 
				
			||||||
 | 
					  '/pet/{petId}/uploadImage':
 | 
				
			||||||
 | 
					    post:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - pet
 | 
				
			||||||
 | 
					      summary: uploads an image
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: uploadFile
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: petId
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: ID of pet to update
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: integer
 | 
				
			||||||
 | 
					            format: int64
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/ApiResponse'
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - petstore_auth:
 | 
				
			||||||
 | 
					            - 'write:pets'
 | 
				
			||||||
 | 
					            - 'read:pets'
 | 
				
			||||||
 | 
					      requestBody:
 | 
				
			||||||
 | 
					        content:
 | 
				
			||||||
 | 
					          multipart/form-data:
 | 
				
			||||||
 | 
					            schema:
 | 
				
			||||||
 | 
					              type: object
 | 
				
			||||||
 | 
					              properties:
 | 
				
			||||||
 | 
					                additionalMetadata:
 | 
				
			||||||
 | 
					                  description: Additional data to pass to server
 | 
				
			||||||
 | 
					                  type: string
 | 
				
			||||||
 | 
					                file:
 | 
				
			||||||
 | 
					                  description: file to upload
 | 
				
			||||||
 | 
					                  type: string
 | 
				
			||||||
 | 
					                  format: binary
 | 
				
			||||||
 | 
					  /store/inventory:
 | 
				
			||||||
 | 
					    get:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - store
 | 
				
			||||||
 | 
					      summary: Returns pet inventories by status
 | 
				
			||||||
 | 
					      description: Returns a map of status codes to quantities
 | 
				
			||||||
 | 
					      operationId: getInventory
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: object
 | 
				
			||||||
 | 
					                additionalProperties:
 | 
				
			||||||
 | 
					                  type: integer
 | 
				
			||||||
 | 
					                  format: int32
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - api_key: []
 | 
				
			||||||
 | 
					  /store/order:
 | 
				
			||||||
 | 
					    post:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - store
 | 
				
			||||||
 | 
					      summary: Place an order for a pet
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: placeOrder
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/xml:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/Order'
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/Order'
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid Order
 | 
				
			||||||
 | 
					      requestBody:
 | 
				
			||||||
 | 
					        content:
 | 
				
			||||||
 | 
					          application/json:
 | 
				
			||||||
 | 
					            schema:
 | 
				
			||||||
 | 
					              $ref: '#/components/schemas/Order'
 | 
				
			||||||
 | 
					        description: order placed for purchasing the pet
 | 
				
			||||||
 | 
					        required: true
 | 
				
			||||||
 | 
					  '/store/order/{orderId}':
 | 
				
			||||||
 | 
					    get:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - store
 | 
				
			||||||
 | 
					      summary: Find purchase order by ID
 | 
				
			||||||
 | 
					      description: >-
 | 
				
			||||||
 | 
					        For valid response try integer IDs with value <= 5 or > 10. Other values
 | 
				
			||||||
 | 
					        will generated exceptions
 | 
				
			||||||
 | 
					      operationId: getOrderById
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: orderId
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: ID of pet that needs to be fetched
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: integer
 | 
				
			||||||
 | 
					            format: int64
 | 
				
			||||||
 | 
					            minimum: 1
 | 
				
			||||||
 | 
					            maximum: 5
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/xml:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/Order'
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/Order'
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid ID supplied
 | 
				
			||||||
 | 
					        '404':
 | 
				
			||||||
 | 
					          description: Order not found
 | 
				
			||||||
 | 
					    delete:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - store
 | 
				
			||||||
 | 
					      summary: Delete purchase order by ID
 | 
				
			||||||
 | 
					      description: >-
 | 
				
			||||||
 | 
					        For valid response try integer IDs with value < 1000. Anything above
 | 
				
			||||||
 | 
					        1000 or nonintegers will generate API errors
 | 
				
			||||||
 | 
					      operationId: deleteOrder
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: orderId
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: ID of the order that needs to be deleted
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid ID supplied
 | 
				
			||||||
 | 
					        '404':
 | 
				
			||||||
 | 
					          description: Order not found
 | 
				
			||||||
 | 
					  /user:
 | 
				
			||||||
 | 
					    post:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - user
 | 
				
			||||||
 | 
					      summary: Create user
 | 
				
			||||||
 | 
					      description: This can only be done by the logged in user.
 | 
				
			||||||
 | 
					      operationId: createUser
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - api_key: []
 | 
				
			||||||
 | 
					      requestBody:
 | 
				
			||||||
 | 
					        content:
 | 
				
			||||||
 | 
					          application/json:
 | 
				
			||||||
 | 
					            schema:
 | 
				
			||||||
 | 
					              $ref: '#/components/schemas/User'
 | 
				
			||||||
 | 
					        description: Created user object
 | 
				
			||||||
 | 
					        required: true
 | 
				
			||||||
 | 
					  /user/createWithArray:
 | 
				
			||||||
 | 
					    post:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - user
 | 
				
			||||||
 | 
					      summary: Creates list of users with given input array
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: createUsersWithArrayInput
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - api_key: []
 | 
				
			||||||
 | 
					      requestBody:
 | 
				
			||||||
 | 
					        $ref: '#/components/requestBodies/UserArray'
 | 
				
			||||||
 | 
					  /user/createWithList:
 | 
				
			||||||
 | 
					    post:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - user
 | 
				
			||||||
 | 
					      summary: Creates list of users with given input array
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: createUsersWithListInput
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - api_key: []
 | 
				
			||||||
 | 
					      requestBody:
 | 
				
			||||||
 | 
					        $ref: '#/components/requestBodies/UserArray'
 | 
				
			||||||
 | 
					  /user/login:
 | 
				
			||||||
 | 
					    get:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - user
 | 
				
			||||||
 | 
					      summary: Logs user into the system
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: loginUser
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: username
 | 
				
			||||||
 | 
					          in: query
 | 
				
			||||||
 | 
					          description: The user name for login
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					            pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
 | 
				
			||||||
 | 
					        - name: password
 | 
				
			||||||
 | 
					          in: query
 | 
				
			||||||
 | 
					          description: The password for login in clear text
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          headers:
 | 
				
			||||||
 | 
					            Set-Cookie:
 | 
				
			||||||
 | 
					              description: >-
 | 
				
			||||||
 | 
					                Cookie authentication key for use with the `api_key`
 | 
				
			||||||
 | 
					                apiKey authentication.
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: string
 | 
				
			||||||
 | 
					                example: AUTH_KEY=abcde12345; Path=/; HttpOnly
 | 
				
			||||||
 | 
					            X-Rate-Limit:
 | 
				
			||||||
 | 
					              description: calls per hour allowed by the user
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: integer
 | 
				
			||||||
 | 
					                format: int32
 | 
				
			||||||
 | 
					            X-Expires-After:
 | 
				
			||||||
 | 
					              description: date in UTC when token expires
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: string
 | 
				
			||||||
 | 
					                format: date-time
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/xml:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: string
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: string
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid username/password supplied
 | 
				
			||||||
 | 
					  /user/logout:
 | 
				
			||||||
 | 
					    get:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - user
 | 
				
			||||||
 | 
					      summary: Logs out current logged in user session
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: logoutUser
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - api_key: []
 | 
				
			||||||
 | 
					  '/user/{username}':
 | 
				
			||||||
 | 
					    get:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - user
 | 
				
			||||||
 | 
					      summary: Get user by user name
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: getUserByName
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: username
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: The name that needs to be fetched. Use user1 for testing.
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/xml:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/User'
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/User'
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid username supplied
 | 
				
			||||||
 | 
					        '404':
 | 
				
			||||||
 | 
					          description: User not found
 | 
				
			||||||
 | 
					    put:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - user
 | 
				
			||||||
 | 
					      summary: Updated user
 | 
				
			||||||
 | 
					      description: This can only be done by the logged in user.
 | 
				
			||||||
 | 
					      operationId: updateUser
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: username
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: name that need to be deleted
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid user supplied
 | 
				
			||||||
 | 
					        '404':
 | 
				
			||||||
 | 
					          description: User not found
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - api_key: []
 | 
				
			||||||
 | 
					      requestBody:
 | 
				
			||||||
 | 
					        content:
 | 
				
			||||||
 | 
					          application/json:
 | 
				
			||||||
 | 
					            schema:
 | 
				
			||||||
 | 
					              $ref: '#/components/schemas/User'
 | 
				
			||||||
 | 
					        description: Updated user object
 | 
				
			||||||
 | 
					        required: true
 | 
				
			||||||
 | 
					    delete:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - user
 | 
				
			||||||
 | 
					      summary: Delete user
 | 
				
			||||||
 | 
					      description: This can only be done by the logged in user.
 | 
				
			||||||
 | 
					      operationId: deleteUser
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: username
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: The name that needs to be deleted
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid username supplied
 | 
				
			||||||
 | 
					        '404':
 | 
				
			||||||
 | 
					          description: User not found
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - api_key: []
 | 
				
			||||||
 | 
					externalDocs:
 | 
				
			||||||
 | 
					  description: Find out more about Swagger
 | 
				
			||||||
 | 
					  url: 'http://swagger.io'
 | 
				
			||||||
 | 
					components:
 | 
				
			||||||
 | 
					  requestBodies:
 | 
				
			||||||
 | 
					    UserArray:
 | 
				
			||||||
 | 
					      content:
 | 
				
			||||||
 | 
					        application/json:
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: array
 | 
				
			||||||
 | 
					            items:
 | 
				
			||||||
 | 
					              $ref: '#/components/schemas/User'
 | 
				
			||||||
 | 
					      description: List of user object
 | 
				
			||||||
 | 
					      required: true
 | 
				
			||||||
 | 
					    Pet:
 | 
				
			||||||
 | 
					      content:
 | 
				
			||||||
 | 
					        application/json:
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					        application/xml:
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            $ref: '#/components/schemas/Pet'
 | 
				
			||||||
 | 
					      description: Pet object that needs to be added to the store
 | 
				
			||||||
 | 
					      required: true
 | 
				
			||||||
 | 
					  securitySchemes:
 | 
				
			||||||
 | 
					    petstore_auth:
 | 
				
			||||||
 | 
					      type: oauth2
 | 
				
			||||||
 | 
					      flows:
 | 
				
			||||||
 | 
					        implicit:
 | 
				
			||||||
 | 
					          authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
 | 
				
			||||||
 | 
					          scopes:
 | 
				
			||||||
 | 
					            'write:pets': modify pets in your account
 | 
				
			||||||
 | 
					            'read:pets': read your pets
 | 
				
			||||||
 | 
					    api_key:
 | 
				
			||||||
 | 
					      type: apiKey
 | 
				
			||||||
 | 
					      name: api_key
 | 
				
			||||||
 | 
					      in: header
 | 
				
			||||||
 | 
					  schemas:
 | 
				
			||||||
 | 
					    Order:
 | 
				
			||||||
 | 
					      title: Pet Order
 | 
				
			||||||
 | 
					      description: An order for a pets from the pet store
 | 
				
			||||||
 | 
					      type: object
 | 
				
			||||||
 | 
					      properties:
 | 
				
			||||||
 | 
					        id:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int64
 | 
				
			||||||
 | 
					        petId:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int64
 | 
				
			||||||
 | 
					        quantity:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int32
 | 
				
			||||||
 | 
					        shipDate:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          format: date-time
 | 
				
			||||||
 | 
					        status:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          description: Order Status
 | 
				
			||||||
 | 
					          enum:
 | 
				
			||||||
 | 
					            - placed
 | 
				
			||||||
 | 
					            - approved
 | 
				
			||||||
 | 
					            - delivered
 | 
				
			||||||
 | 
					        complete:
 | 
				
			||||||
 | 
					          type: boolean
 | 
				
			||||||
 | 
					          default: false
 | 
				
			||||||
 | 
					      xml:
 | 
				
			||||||
 | 
					        name: Order
 | 
				
			||||||
 | 
					    Category:
 | 
				
			||||||
 | 
					      title: Pet category
 | 
				
			||||||
 | 
					      description: A category for a pet
 | 
				
			||||||
 | 
					      type: object
 | 
				
			||||||
 | 
					      properties:
 | 
				
			||||||
 | 
					        id:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int64
 | 
				
			||||||
 | 
					        name:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
 | 
				
			||||||
 | 
					      xml:
 | 
				
			||||||
 | 
					        name: Category
 | 
				
			||||||
 | 
					    User:
 | 
				
			||||||
 | 
					      title: a User
 | 
				
			||||||
 | 
					      description: A User who is purchasing from the pet store
 | 
				
			||||||
 | 
					      type: object
 | 
				
			||||||
 | 
					      properties:
 | 
				
			||||||
 | 
					        id:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int64
 | 
				
			||||||
 | 
					        username:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					        firstName:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					        lastName:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					        email:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					        password:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					        phone:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					        userStatus:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int32
 | 
				
			||||||
 | 
					          description: User Status
 | 
				
			||||||
 | 
					      xml:
 | 
				
			||||||
 | 
					        name: User
 | 
				
			||||||
 | 
					    Tag:
 | 
				
			||||||
 | 
					      title: Pet Tag
 | 
				
			||||||
 | 
					      description: A tag for a pet
 | 
				
			||||||
 | 
					      type: object
 | 
				
			||||||
 | 
					      properties:
 | 
				
			||||||
 | 
					        id:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int64
 | 
				
			||||||
 | 
					        name:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					      xml:
 | 
				
			||||||
 | 
					        name: Tag
 | 
				
			||||||
 | 
					    Pet:
 | 
				
			||||||
 | 
					      title: a Pet
 | 
				
			||||||
 | 
					      description: A pet for sale in the pet store
 | 
				
			||||||
 | 
					      type: object
 | 
				
			||||||
 | 
					      required:
 | 
				
			||||||
 | 
					        - name
 | 
				
			||||||
 | 
					        - photoUrls
 | 
				
			||||||
 | 
					      properties:
 | 
				
			||||||
 | 
					        id:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int64
 | 
				
			||||||
 | 
					        category:
 | 
				
			||||||
 | 
					          $ref: '#/components/schemas/Category'
 | 
				
			||||||
 | 
					        name:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          example: doggie
 | 
				
			||||||
 | 
					        photoUrls:
 | 
				
			||||||
 | 
					          type: array
 | 
				
			||||||
 | 
					          xml:
 | 
				
			||||||
 | 
					            name: photoUrl
 | 
				
			||||||
 | 
					            wrapped: true
 | 
				
			||||||
 | 
					          items:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					        tags:
 | 
				
			||||||
 | 
					          type: array
 | 
				
			||||||
 | 
					          xml:
 | 
				
			||||||
 | 
					            name: tag
 | 
				
			||||||
 | 
					            wrapped: true
 | 
				
			||||||
 | 
					          items:
 | 
				
			||||||
 | 
					            $ref: '#/components/schemas/Tag'
 | 
				
			||||||
 | 
					        status:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          description: pet status in the store
 | 
				
			||||||
 | 
					          deprecated: true
 | 
				
			||||||
 | 
					          enum:
 | 
				
			||||||
 | 
					            - available
 | 
				
			||||||
 | 
					            - pending
 | 
				
			||||||
 | 
					            - sold
 | 
				
			||||||
 | 
					      xml:
 | 
				
			||||||
 | 
					        name: Pet
 | 
				
			||||||
 | 
					    ApiResponse:
 | 
				
			||||||
 | 
					      title: An uploaded response
 | 
				
			||||||
 | 
					      description: Describes the result of uploading an image resource
 | 
				
			||||||
 | 
					      type: object
 | 
				
			||||||
 | 
					      properties:
 | 
				
			||||||
 | 
					        code:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int32
 | 
				
			||||||
 | 
					        type:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					        message:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					    format_test:
 | 
				
			||||||
 | 
					      type: object
 | 
				
			||||||
 | 
					      required:
 | 
				
			||||||
 | 
					        - number
 | 
				
			||||||
 | 
					        - byte
 | 
				
			||||||
 | 
					        - date
 | 
				
			||||||
 | 
					        - password
 | 
				
			||||||
 | 
					      properties:
 | 
				
			||||||
 | 
					        integer:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          maximum: 100
 | 
				
			||||||
 | 
					          minimum: 10
 | 
				
			||||||
 | 
					          multipleOf: 2
 | 
				
			||||||
 | 
					        int32:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int32
 | 
				
			||||||
 | 
					          maximum: 200
 | 
				
			||||||
 | 
					          minimum: 20
 | 
				
			||||||
 | 
					        int64:
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int64
 | 
				
			||||||
 | 
					        number:
 | 
				
			||||||
 | 
					          maximum: 543.2
 | 
				
			||||||
 | 
					          minimum: 32.1
 | 
				
			||||||
 | 
					          type: number
 | 
				
			||||||
 | 
					          multipleOf: 32.5
 | 
				
			||||||
 | 
					        float:
 | 
				
			||||||
 | 
					          type: number
 | 
				
			||||||
 | 
					          format: float
 | 
				
			||||||
 | 
					          maximum: 987.6
 | 
				
			||||||
 | 
					          minimum: 54.3
 | 
				
			||||||
 | 
					        double:
 | 
				
			||||||
 | 
					          type: number
 | 
				
			||||||
 | 
					          format: double
 | 
				
			||||||
 | 
					          maximum: 123.4
 | 
				
			||||||
 | 
					          minimum: 67.8
 | 
				
			||||||
 | 
					        decimal:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          format: number
 | 
				
			||||||
 | 
					        string:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          pattern: '/[a-z]/i'
 | 
				
			||||||
 | 
					        byte:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          format: byte
 | 
				
			||||||
 | 
					        binary:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          format: binary
 | 
				
			||||||
 | 
					        date:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          format: date
 | 
				
			||||||
 | 
					          example: '2020-02-02'
 | 
				
			||||||
 | 
					        dateTime:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          format: date-time
 | 
				
			||||||
 | 
					          example: '2007-12-03T10:15:30+01:00'
 | 
				
			||||||
 | 
					        uuid:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          format: uuid
 | 
				
			||||||
 | 
					          example: 72f98069-206d-4f12-9f12-3d1e525a8e84
 | 
				
			||||||
 | 
					        password:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          format: password
 | 
				
			||||||
 | 
					          maxLength: 64
 | 
				
			||||||
 | 
					          minLength: 10
 | 
				
			||||||
 | 
					        pattern_with_digits:
 | 
				
			||||||
 | 
					          description: A string that is a 10 digit number. Can have leading zeros.
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          pattern: '^\d{10}$'
 | 
				
			||||||
 | 
					        pattern_with_digits_and_delimiter:
 | 
				
			||||||
 | 
					          description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          pattern: '/^image_\d{1,3}$/i'
 | 
				
			||||||
@ -13,6 +13,7 @@ src/petstore/api_error.cr
 | 
				
			|||||||
src/petstore/configuration.cr
 | 
					src/petstore/configuration.cr
 | 
				
			||||||
src/petstore/models/api_response.cr
 | 
					src/petstore/models/api_response.cr
 | 
				
			||||||
src/petstore/models/category.cr
 | 
					src/petstore/models/category.cr
 | 
				
			||||||
 | 
					src/petstore/models/format_test.cr
 | 
				
			||||||
src/petstore/models/order.cr
 | 
					src/petstore/models/order.cr
 | 
				
			||||||
src/petstore/models/pet.cr
 | 
					src/petstore/models/pet.cr
 | 
				
			||||||
src/petstore/models/tag.cr
 | 
					src/petstore/models/tag.cr
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										122
									
								
								samples/client/petstore/crystal/spec/models/format_test_spec.cr
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								samples/client/petstore/crystal/spec/models/format_test_spec.cr
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,122 @@
 | 
				
			|||||||
 | 
					# #OpenAPI Petstore
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#The version of the OpenAPI document: 1.0.0
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#Generated by: https://openapi-generator.tech
 | 
				
			||||||
 | 
					#OpenAPI Generator version: 6.2.1-SNAPSHOT
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require "../spec_helper"
 | 
				
			||||||
 | 
					require "json"
 | 
				
			||||||
 | 
					require "time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Unit tests for Petstore::FormatTest
 | 
				
			||||||
 | 
					# Automatically generated by openapi-generator (https://openapi-generator.tech)
 | 
				
			||||||
 | 
					# Please update as you see appropriate
 | 
				
			||||||
 | 
					describe Petstore::FormatTest do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test an instance of FormatTest" do
 | 
				
			||||||
 | 
					    it "should create an instance of FormatTest" do
 | 
				
			||||||
 | 
					      #instance = Petstore::FormatTest.new
 | 
				
			||||||
 | 
					      #expect(instance).to be_instance_of(Petstore::FormatTest)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  describe "test attribute 'integer'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'int32'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'int64'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'number'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'float'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'double'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'decimal'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'string'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'byte'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'binary'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'date'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'date_time'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'uuid'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'password'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'pattern_with_digits'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "test attribute 'pattern_with_digits_and_delimiter'" do
 | 
				
			||||||
 | 
					    it "should work" do
 | 
				
			||||||
 | 
					      # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@ -8,6 +8,7 @@
 | 
				
			|||||||
#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
					#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require "big"
 | 
				
			||||||
require "json"
 | 
					require "json"
 | 
				
			||||||
require "time"
 | 
					require "time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@
 | 
				
			|||||||
#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
					#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require "big"
 | 
				
			||||||
require "json"
 | 
					require "json"
 | 
				
			||||||
require "time"
 | 
					require "time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,439 @@
 | 
				
			|||||||
 | 
					# #OpenAPI Petstore
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#The version of the OpenAPI document: 1.0.0
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#Generated by: https://openapi-generator.tech
 | 
				
			||||||
 | 
					#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require "big"
 | 
				
			||||||
 | 
					require "json"
 | 
				
			||||||
 | 
					require "time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module Petstore
 | 
				
			||||||
 | 
					  class FormatTest
 | 
				
			||||||
 | 
					    include JSON::Serializable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Required properties
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "number", type: Float64, nillable: false, emit_null: false)]
 | 
				
			||||||
 | 
					    property number : Float64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "byte", type: String, nillable: false, emit_null: false)]
 | 
				
			||||||
 | 
					    property byte : String
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "date", type: Time, nillable: false, emit_null: false)]
 | 
				
			||||||
 | 
					    property date : Time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "password", type: String, nillable: false, emit_null: false)]
 | 
				
			||||||
 | 
					    property password : String
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Optional properties
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "integer", type: Int32?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property integer : Int32?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "int32", type: Int32?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property int32 : Int32?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "int64", type: Int64?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property int64 : Int64?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "float", type: Float32?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property float : Float32?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "double", type: Float64?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property double : Float64?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "decimal", type: Float64?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property decimal : Float64?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "string", type: String?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property string : String?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "binary", type: ::File?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property binary : ::File?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "dateTime", type: Time?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property date_time : Time?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "uuid", type: String?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property uuid : String?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # A string that is a 10 digit number. Can have leading zeros.
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "pattern_with_digits", type: String?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property pattern_with_digits : String?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.
 | 
				
			||||||
 | 
					    @[JSON::Field(key: "pattern_with_digits_and_delimiter", type: String?, nillable: true, emit_null: false)]
 | 
				
			||||||
 | 
					    property pattern_with_digits_and_delimiter : String?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Initializes the object
 | 
				
			||||||
 | 
					    # @param [Hash] attributes Model attributes in the form of hash
 | 
				
			||||||
 | 
					    def initialize(@number : Float64, @byte : String, @date : Time, @password : String, @integer : Int32?, @int32 : Int32?, @int64 : Int64?, @float : Float32?, @double : Float64?, @decimal : Float64?, @string : String?, @binary : ::File?, @date_time : Time?, @uuid : String?, @pattern_with_digits : String?, @pattern_with_digits_and_delimiter : String?)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Show invalid properties with the reasons. Usually used together with valid?
 | 
				
			||||||
 | 
					    # @return Array for valid properties with the reasons
 | 
				
			||||||
 | 
					    def list_invalid_properties
 | 
				
			||||||
 | 
					      invalid_properties = Array(String).new
 | 
				
			||||||
 | 
					      if !@integer.nil? && @integer > 100
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"integer\", must be smaller than or equal to 100.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if !@integer.nil? && @integer < 10
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"integer\", must be greater than or equal to 10.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if !@int32.nil? && @int32 > 200
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"int32\", must be smaller than or equal to 200.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if !@int32.nil? && @int32 < 20
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"int32\", must be greater than or equal to 20.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if @number > 543.2
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"number\", must be smaller than or equal to 543.2.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if @number < 32.1
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"number\", must be greater than or equal to 32.1.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if !@float.nil? && @float > 987.6
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"float\", must be smaller than or equal to 987.6.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if !@float.nil? && @float < 54.3
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"float\", must be greater than or equal to 54.3.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if !@double.nil? && @double > 123.4
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"double\", must be smaller than or equal to 123.4.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if !@double.nil? && @double < 67.8
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"double\", must be greater than or equal to 67.8.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      pattern = Regexp.new(/[a-z]/i)
 | 
				
			||||||
 | 
					      if !@string.nil? && @string !~ pattern
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"string\", must conform to the pattern #{pattern}.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if @password.to_s.size > 64
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"password\", the character length must be smaller than or equal to 64.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if @password.to_s.size < 10
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"password\", the character length must be great than or equal to 10.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      pattern = Regexp.new(/^\d{10}$/)
 | 
				
			||||||
 | 
					      if !@pattern_with_digits.nil? && @pattern_with_digits !~ pattern
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"pattern_with_digits\", must conform to the pattern #{pattern}.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      pattern = Regexp.new(/^image_\d{1,3}$/i)
 | 
				
			||||||
 | 
					      if !@pattern_with_digits_and_delimiter.nil? && @pattern_with_digits_and_delimiter !~ pattern
 | 
				
			||||||
 | 
					        invalid_properties.push("invalid value for \"pattern_with_digits_and_delimiter\", must conform to the pattern #{pattern}.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      invalid_properties
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Check to see if the all the properties in the model are valid
 | 
				
			||||||
 | 
					    # @return true if the model is valid
 | 
				
			||||||
 | 
					    def valid?
 | 
				
			||||||
 | 
					      return false if !@integer.nil? && @integer > 100
 | 
				
			||||||
 | 
					      return false if !@integer.nil? && @integer < 10
 | 
				
			||||||
 | 
					      return false if !@int32.nil? && @int32 > 200
 | 
				
			||||||
 | 
					      return false if !@int32.nil? && @int32 < 20
 | 
				
			||||||
 | 
					      return false if @number > 543.2
 | 
				
			||||||
 | 
					      return false if @number < 32.1
 | 
				
			||||||
 | 
					      return false if !@float.nil? && @float > 987.6
 | 
				
			||||||
 | 
					      return false if !@float.nil? && @float < 54.3
 | 
				
			||||||
 | 
					      return false if !@double.nil? && @double > 123.4
 | 
				
			||||||
 | 
					      return false if !@double.nil? && @double < 67.8
 | 
				
			||||||
 | 
					      return false if !@string.nil? && @string !~ Regexp.new(/[a-z]/i)
 | 
				
			||||||
 | 
					      return false if @password.to_s.size > 64
 | 
				
			||||||
 | 
					      return false if @password.to_s.size < 10
 | 
				
			||||||
 | 
					      return false if !@pattern_with_digits.nil? && @pattern_with_digits !~ Regexp.new(/^\d{10}$/)
 | 
				
			||||||
 | 
					      return false if !@pattern_with_digits_and_delimiter.nil? && @pattern_with_digits_and_delimiter !~ Regexp.new(/^image_\d{1,3}$/i)
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Custom attribute writer method with validation
 | 
				
			||||||
 | 
					    # @param [Object] integer Value to be assigned
 | 
				
			||||||
 | 
					    def integer=(integer)
 | 
				
			||||||
 | 
					      if !integer.nil? && integer > 100
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"integer\", must be smaller than or equal to 100.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if !integer.nil? && integer < 10
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"integer\", must be greater than or equal to 10.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      @integer = integer
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Custom attribute writer method with validation
 | 
				
			||||||
 | 
					    # @param [Object] int32 Value to be assigned
 | 
				
			||||||
 | 
					    def int32=(int32)
 | 
				
			||||||
 | 
					      if !int32.nil? && int32 > 200
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"int32\", must be smaller than or equal to 200.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if !int32.nil? && int32 < 20
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"int32\", must be greater than or equal to 20.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      @int32 = int32
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Custom attribute writer method with validation
 | 
				
			||||||
 | 
					    # @param [Object] number Value to be assigned
 | 
				
			||||||
 | 
					    def number=(number)
 | 
				
			||||||
 | 
					      if number > 543.2
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"number\", must be smaller than or equal to 543.2.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if number < 32.1
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"number\", must be greater than or equal to 32.1.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      @number = number
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Custom attribute writer method with validation
 | 
				
			||||||
 | 
					    # @param [Object] float Value to be assigned
 | 
				
			||||||
 | 
					    def float=(float)
 | 
				
			||||||
 | 
					      if !float.nil? && float > 987.6
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"float\", must be smaller than or equal to 987.6.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if !float.nil? && float < 54.3
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"float\", must be greater than or equal to 54.3.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      @float = float
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Custom attribute writer method with validation
 | 
				
			||||||
 | 
					    # @param [Object] double Value to be assigned
 | 
				
			||||||
 | 
					    def double=(double)
 | 
				
			||||||
 | 
					      if !double.nil? && double > 123.4
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"double\", must be smaller than or equal to 123.4.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if !double.nil? && double < 67.8
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"double\", must be greater than or equal to 67.8.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      @double = double
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Custom attribute writer method with validation
 | 
				
			||||||
 | 
					    # @param [Object] string Value to be assigned
 | 
				
			||||||
 | 
					    def string=(string)
 | 
				
			||||||
 | 
					      pattern = Regexp.new(/[a-z]/i)
 | 
				
			||||||
 | 
					      if !string.nil? && string !~ pattern
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"string\", must conform to the pattern #{pattern}.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      @string = string
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Custom attribute writer method with validation
 | 
				
			||||||
 | 
					    # @param [Object] password Value to be assigned
 | 
				
			||||||
 | 
					    def password=(password)
 | 
				
			||||||
 | 
					      if password.to_s.size > 64
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"password\", the character length must be smaller than or equal to 64.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if password.to_s.size < 10
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"password\", the character length must be great than or equal to 10.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      @password = password
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Custom attribute writer method with validation
 | 
				
			||||||
 | 
					    # @param [Object] pattern_with_digits Value to be assigned
 | 
				
			||||||
 | 
					    def pattern_with_digits=(pattern_with_digits)
 | 
				
			||||||
 | 
					      pattern = Regexp.new(/^\d{10}$/)
 | 
				
			||||||
 | 
					      if !pattern_with_digits.nil? && pattern_with_digits !~ pattern
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"pattern_with_digits\", must conform to the pattern #{pattern}.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      @pattern_with_digits = pattern_with_digits
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Custom attribute writer method with validation
 | 
				
			||||||
 | 
					    # @param [Object] pattern_with_digits_and_delimiter Value to be assigned
 | 
				
			||||||
 | 
					    def pattern_with_digits_and_delimiter=(pattern_with_digits_and_delimiter)
 | 
				
			||||||
 | 
					      pattern = Regexp.new(/^image_\d{1,3}$/i)
 | 
				
			||||||
 | 
					      if !pattern_with_digits_and_delimiter.nil? && pattern_with_digits_and_delimiter !~ pattern
 | 
				
			||||||
 | 
					        raise ArgumentError.new("invalid value for \"pattern_with_digits_and_delimiter\", must conform to the pattern #{pattern}.")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      @pattern_with_digits_and_delimiter = pattern_with_digits_and_delimiter
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Checks equality by comparing each attribute.
 | 
				
			||||||
 | 
					    # @param [Object] Object to be compared
 | 
				
			||||||
 | 
					    def ==(o)
 | 
				
			||||||
 | 
					      return true if self.same?(o)
 | 
				
			||||||
 | 
					      self.class == o.class &&
 | 
				
			||||||
 | 
					          integer == o.integer &&
 | 
				
			||||||
 | 
					          int32 == o.int32 &&
 | 
				
			||||||
 | 
					          int64 == o.int64 &&
 | 
				
			||||||
 | 
					          number == o.number &&
 | 
				
			||||||
 | 
					          float == o.float &&
 | 
				
			||||||
 | 
					          double == o.double &&
 | 
				
			||||||
 | 
					          decimal == o.decimal &&
 | 
				
			||||||
 | 
					          string == o.string &&
 | 
				
			||||||
 | 
					          byte == o.byte &&
 | 
				
			||||||
 | 
					          binary == o.binary &&
 | 
				
			||||||
 | 
					          date == o.date &&
 | 
				
			||||||
 | 
					          date_time == o.date_time &&
 | 
				
			||||||
 | 
					          uuid == o.uuid &&
 | 
				
			||||||
 | 
					          password == o.password &&
 | 
				
			||||||
 | 
					          pattern_with_digits == o.pattern_with_digits &&
 | 
				
			||||||
 | 
					          pattern_with_digits_and_delimiter == o.pattern_with_digits_and_delimiter
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # @see the `==` method
 | 
				
			||||||
 | 
					    # @param [Object] Object to be compared
 | 
				
			||||||
 | 
					    def eql?(o)
 | 
				
			||||||
 | 
					      self == o
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Calculates hash code according to all attributes.
 | 
				
			||||||
 | 
					    # @return [Integer] Hash code
 | 
				
			||||||
 | 
					    def hash
 | 
				
			||||||
 | 
					      [integer, int32, int64, number, float, double, decimal, string, byte, binary, date, date_time, uuid, password, pattern_with_digits, pattern_with_digits_and_delimiter].hash
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Builds the object from hash
 | 
				
			||||||
 | 
					    # @param [Hash] attributes Model attributes in the form of hash
 | 
				
			||||||
 | 
					    # @return [Object] Returns the model itself
 | 
				
			||||||
 | 
					    def self.build_from_hash(attributes)
 | 
				
			||||||
 | 
					      new.build_from_hash(attributes)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Builds the object from hash
 | 
				
			||||||
 | 
					    # @param [Hash] attributes Model attributes in the form of hash
 | 
				
			||||||
 | 
					    # @return [Object] Returns the model itself
 | 
				
			||||||
 | 
					    def build_from_hash(attributes)
 | 
				
			||||||
 | 
					      return nil unless attributes.is_a?(Hash)
 | 
				
			||||||
 | 
					      self.class.openapi_types.each_pair do |key, type|
 | 
				
			||||||
 | 
					        if !attributes[self.class.attribute_map[key]]? && self.class.openapi_nullable.includes?(key)
 | 
				
			||||||
 | 
					          self.send("#{key}=", nil)
 | 
				
			||||||
 | 
					        elsif type =~ /\AArray<(.*)>/i
 | 
				
			||||||
 | 
					          # check to ensure the input is an array given that the attribute
 | 
				
			||||||
 | 
					          # is documented as an array but the input is not
 | 
				
			||||||
 | 
					          if attributes[self.class.attribute_map[key]].is_a?(Array)
 | 
				
			||||||
 | 
					            self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
 | 
				
			||||||
 | 
					          end
 | 
				
			||||||
 | 
					        elsif !attributes[self.class.attribute_map[key]].nil?
 | 
				
			||||||
 | 
					          self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      self
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Deserializes the data based on type
 | 
				
			||||||
 | 
					    # @param string type Data type
 | 
				
			||||||
 | 
					    # @param string value Value to be deserialized
 | 
				
			||||||
 | 
					    # @return [Object] Deserialized data
 | 
				
			||||||
 | 
					    def _deserialize(type, value)
 | 
				
			||||||
 | 
					      case type.to_sym
 | 
				
			||||||
 | 
					      when :Time
 | 
				
			||||||
 | 
					        Time.parse(value)
 | 
				
			||||||
 | 
					      when :Date
 | 
				
			||||||
 | 
					        Date.parse(value)
 | 
				
			||||||
 | 
					      when :String
 | 
				
			||||||
 | 
					        value.to_s
 | 
				
			||||||
 | 
					      when :Integer
 | 
				
			||||||
 | 
					        value.to_i
 | 
				
			||||||
 | 
					      when :Float
 | 
				
			||||||
 | 
					        value.to_f
 | 
				
			||||||
 | 
					      when :Boolean
 | 
				
			||||||
 | 
					        if value.to_s =~ /\A(true|t|yes|y|1)\z/i
 | 
				
			||||||
 | 
					          true
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					          false
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					      when :Object
 | 
				
			||||||
 | 
					        # generic object (usually a Hash), return directly
 | 
				
			||||||
 | 
					        value
 | 
				
			||||||
 | 
					      when /\AArray<(?<inner_type>.+)>\z/
 | 
				
			||||||
 | 
					        inner_type = Regexp.last_match[:inner_type]
 | 
				
			||||||
 | 
					        value.map { |v| _deserialize(inner_type, v) }
 | 
				
			||||||
 | 
					      when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
 | 
				
			||||||
 | 
					        k_type = Regexp.last_match[:k_type]
 | 
				
			||||||
 | 
					        v_type = Regexp.last_match[:v_type]
 | 
				
			||||||
 | 
					        ({} of Symbol => String).tap do |hash|
 | 
				
			||||||
 | 
					          value.each do |k, v|
 | 
				
			||||||
 | 
					            hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
 | 
				
			||||||
 | 
					          end
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					      else # model
 | 
				
			||||||
 | 
					        # models (e.g. Pet) or oneOf
 | 
				
			||||||
 | 
					        klass = Petstore.const_get(type)
 | 
				
			||||||
 | 
					        klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Returns the string representation of the object
 | 
				
			||||||
 | 
					    # @return [String] String presentation of the object
 | 
				
			||||||
 | 
					    def to_s
 | 
				
			||||||
 | 
					      to_hash.to_s
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # to_body is an alias to to_hash (backward compatibility)
 | 
				
			||||||
 | 
					    # @return [Hash] Returns the object in the form of hash
 | 
				
			||||||
 | 
					    def to_body
 | 
				
			||||||
 | 
					      to_hash
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Returns the object in the form of hash
 | 
				
			||||||
 | 
					    # @return [Hash] Returns the object in the form of hash
 | 
				
			||||||
 | 
					    def to_hash
 | 
				
			||||||
 | 
					      hash = {} of Symbol => String
 | 
				
			||||||
 | 
					      self.class.attribute_map.each_pair do |attr, param|
 | 
				
			||||||
 | 
					        value = self.send(attr)
 | 
				
			||||||
 | 
					        if value.nil?
 | 
				
			||||||
 | 
					          is_nullable = self.class.openapi_nullable.includes?(attr)
 | 
				
			||||||
 | 
					          next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        hash[param] = _to_hash(value)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					      hash
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Outputs non-array value in the form of hash
 | 
				
			||||||
 | 
					    # For object, use to_hash. Otherwise, just return the value
 | 
				
			||||||
 | 
					    # @param [Object] value Any valid value
 | 
				
			||||||
 | 
					    # @return [Hash] Returns the value in the form of hash
 | 
				
			||||||
 | 
					    def _to_hash(value)
 | 
				
			||||||
 | 
					      if value.is_a?(Array)
 | 
				
			||||||
 | 
					        value.compact.map { |v| _to_hash(v) }
 | 
				
			||||||
 | 
					      elsif value.is_a?(Hash)
 | 
				
			||||||
 | 
					        ({} of Symbol => String).tap do |hash|
 | 
				
			||||||
 | 
					          value.each { |k, v| hash[k] = _to_hash(v) }
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					      elsif value.respond_to? :to_hash
 | 
				
			||||||
 | 
					        value.to_hash
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        value
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@ -8,6 +8,7 @@
 | 
				
			|||||||
#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
					#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require "big"
 | 
				
			||||||
require "json"
 | 
					require "json"
 | 
				
			||||||
require "time"
 | 
					require "time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@
 | 
				
			|||||||
#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
					#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require "big"
 | 
				
			||||||
require "json"
 | 
					require "json"
 | 
				
			||||||
require "time"
 | 
					require "time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@
 | 
				
			|||||||
#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
					#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require "big"
 | 
				
			||||||
require "json"
 | 
					require "json"
 | 
				
			||||||
require "time"
 | 
					require "time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@
 | 
				
			|||||||
#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
					#OpenAPI Generator version: 6.3.0-SNAPSHOT
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require "big"
 | 
				
			||||||
require "json"
 | 
					require "json"
 | 
				
			||||||
require "time"
 | 
					require "time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user