We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In one of the generated api dart code OneOf is not imported
Generated code with the following schema
I'm not sure where the problem is so this is just a stripped down version of mine
{ "components": { "schemas": { "Abilities": { "properties": { "charisma": { "$ref": "#/components/schemas/AbilityScore" }, "constitution": { "$ref": "#/components/schemas/AbilityScore" }, "dexterity": { "$ref": "#/components/schemas/AbilityScore" }, "intelligence": { "$ref": "#/components/schemas/AbilityScore" }, "strength": { "$ref": "#/components/schemas/AbilityScore" }, "wisdom": { "$ref": "#/components/schemas/AbilityScore" } }, "required": [ "strength", "dexterity", "constitution", "intelligence", "wisdom", "charisma" ], "type": "object" }, "AbilityScore": { "properties": { "proficiency": { "type": "boolean" }, "score": { "format": "int32", "minimum": 0, "type": "integer" } }, "required": [ "score", "proficiency" ], "type": "object" }, "ClassProperties": { "properties": { "abilitiesModifiers": { "$ref": "#/components/schemas/Abilities" }, "additionalFightingStyle": { "type": [ "string", "null" ] }, "fightingStyle": { "type": [ "string", "null" ] }, "level": { "description": "The level of the class", "format": "int32", "minimum": 0, "type": "integer" }, "spellCasting": { "allOf": [ { "type": "null" }, { "$ref": "#/components/schemas/ClassSpellCasting", "description": "Indexes from https://www.dnd5eapi.co/api/spells/" } ] }, "subclass": { "description": "Index from https://www.dnd5eapi.co/api/subclasses/", "type": [ "string", "null" ] } }, "required": [ "level", "abilitiesModifiers" ], "type": "object" }, "ClassSpellCasting": { "oneOf": [ { "properties": { "knowledgePrepared": { "properties": { "pending_preparation": { "description": "If the user has already prepared spells for the day", "type": "boolean" }, "spells_index": { "description": "Indexes from https://www.dnd5eapi.co/api/spells/", "items": { "items": { "type": "string" }, "type": "array" }, "type": "array" }, "spells_prepared_index": { "description": "Indexes from https://www.dnd5eapi.co/api/spells/", "items": { "items": { "type": "string" }, "type": "array" }, "type": "array" } }, "required": [ "spells_index", "spells_prepared_index", "pending_preparation" ], "type": "object" } }, "required": [ "knowledgePrepared" ], "type": "object" }, { "properties": { "alreadyKnowPrepared": { "properties": { "pending_preparation": { "description": "If the user has already prepared spells for the day", "type": "boolean" }, "spells_prepared_index": { "description": "Indexes from https://www.dnd5eapi.co/api/spells/", "items": { "items": { "type": "string" }, "type": "array" }, "type": "array" } }, "required": [ "spells_prepared_index", "pending_preparation" ], "type": "object" } }, "required": [ "alreadyKnowPrepared" ], "type": "object" }, { "properties": { "knowledgeAlreadyPrepared": { "properties": { "spells_index": { "description": "Indexes from https://www.dnd5eapi.co/api/spells/", "items": { "items": { "type": "string" }, "type": "array" }, "type": "array" }, "usable_slots": { "$ref": "#/components/schemas/UsableSlots" } }, "required": [ "spells_index", "usable_slots" ], "type": "object" } }, "required": [ "knowledgeAlreadyPrepared" ], "type": "object" } ] }, "Spell": { "properties": { "index": { "type": "string" }, "level": { "format": "int32", "type": "integer" } }, "required": [ "index", "level" ], "type": "object" }, "UsableSlots": { "properties": { "level1": { "format": "int32", "minimum": 0, "type": "integer" }, "level2": { "format": "int32", "minimum": 0, "type": "integer" }, "level3": { "format": "int32", "minimum": 0, "type": "integer" }, "level4": { "format": "int32", "minimum": 0, "type": "integer" }, "level5": { "format": "int32", "minimum": 0, "type": "integer" }, "level6": { "format": "int32", "minimum": 0, "type": "integer" }, "level7": { "format": "int32", "minimum": 0, "type": "integer" }, "level8": { "format": "int32", "minimum": 0, "type": "integer" }, "level9": { "format": "int32", "minimum": 0, "type": "integer" } }, "required": [ "level1", "level2", "level3", "level4", "level5", "level6", "level7", "level8", "level9" ], "type": "object" } } }, "info": { "title": "masterai", "version": "0.1.0" }, "openapi": "3.1.0" }
@Openapi( additionalProperties: DioProperties(pubName: 'masterai_api', pubAuthor: 'DreamingCodes'), inputSpec: InputSpec(path: 'openapi/openapi.json'), generatorName: Generator.dio, runSourceGenOnOutput: true, outputDirectory: 'api/masterai_api', ) class MasteraiClient {}
OneOf gets imported and everything works.
Linux
6.0.0
3.24.3
stable
The text was updated successfully, but these errors were encountered:
Hi, could you try adding import mappig config to your annotation? That seemed to work for me when I had this issue last time
@Openapi( additionalProperties: DioProperties(pubName: 'masterai_api', pubAuthor: 'DreamingCodes'), inputSpec: InputSpec(path: 'openapi/openapi.json'), importMappings: { 'OneOf': 'package:one_of/one_of.dart', // <--- add this }, generatorName: Generator.dio, runSourceGenOnOutput: true, outputDirectory: 'api/masterai_api', ) class MasteraiClient {}
Sorry, something went wrong.
No branches or pull requests
Description of the bug
In one of the generated api dart code OneOf is not imported
Steps to reproduce
Generated code with the following schema
Minimal openapi specification
I'm not sure where the problem is so this is just a stripped down version of mine
Annotation used
Expected behavior
OneOf gets imported and everything works.
Platform
Linux
Library version
6.0.0
Flutter version
3.24.3
Flutter channel
stable
The text was updated successfully, but these errors were encountered: