mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-05 07:01:01 +00:00
Include base_object model into module structure
This commit is contained in:
parent
f766614b4d
commit
6eaaa5cc69
@ -1,5 +1,6 @@
|
||||
# base class containing fundamental method such as to_hash, build_from_hash and more
|
||||
class BaseObject
|
||||
module {{moduleName}}
|
||||
# base class containing fundamental method such as to_hash, build_from_hash and more
|
||||
class BaseObject
|
||||
|
||||
# return the object in the form of hash
|
||||
def to_body
|
||||
@ -47,13 +48,11 @@ class BaseObject
|
||||
false
|
||||
end
|
||||
else # model
|
||||
_model = Object.const_get(type).new
|
||||
_model = {{moduleName}}.const_get(type).new
|
||||
_model.build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
# to_body is an alias to to_body (backward compatibility)
|
||||
def to_hash
|
||||
hash = {}
|
||||
@ -80,4 +79,5 @@ class BaseObject
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,3 @@
|
||||
require_relative 'base_object'
|
||||
|
||||
module {{moduleName}}
|
||||
{{#models}} # {{description}}
|
||||
{{#model}} class {{classname}} < BaseObject
|
||||
|
@ -7,6 +7,7 @@ require '{{gemName}}/swagger/response'
|
||||
require '{{gemName}}/swagger/version'
|
||||
|
||||
# Models
|
||||
require '{{modelPackage}}/base_object'
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
require '{{importPath}}'
|
||||
|
Loading…
x
Reference in New Issue
Block a user