Open pratikpakhale opened 4 months ago
- Issue - Choosing a subfield oneOf select box is rendered seperately but a type element is also present in the properties.
I don't see the problem here. For example in #fertilizer
the type of the fertilizer_type
property resides only in properties/fertilizer_type/type
. Then depending on the choice of the value of "fertilizer_type", there may be different additional properties. These reside in properties
in each #fertilizer/oneOf
where properties/fertilizer_type/const
is used to choose the right element of the oneOf
. The fertilizer_type
property has the role of the discriminator object of OpenAPI based on which additional properties are introduced.
- Issue - Some titles are missing to elements
Whenever this is the case, the property key can be used as a fall-back title for a property, and value of the const
can be used as a fall-back title for the title of a choice. When a title translation is missing, the english title can be used as a fallback.
As to your example however, in #fertilizer/fertilizer_applic_method
the title is not missing as it resides in its allOf[0]
. This is the title for the property, and the tiles in the elements of #/$defs/fertilizer_applic_method/oneOf
are for the choices.
- Issue - The elements are not inside the properties field
Right, I have now moved fertilizer_material
and fertilizer_material_source
into properties
.
- Issue - Select multiple options from the select box and render a data table to get inputs.
The harvest_list
propety of #harvest
is of type array
and its elements are objects that have properties. The type array
should be enough to determine that there may be multiple harvested crops. I don't think it is necessary to treat a single harvested crop (an array of length 1) differently than multiple harvested crops (an array of length more than 1). I am not sure what is the best UI approach for adding or removing elements to/from the array, and whether any translated text (maybe to be put to an x-ui
) is needed for these actions.
- Issue - Lack of titles for dropdown choices
Elements of "#grazing/properties/grazing_species_age_group/oneOf" are indeed missing titles. See my comment about fallbacks under issue 2. However, I have now added the english titles for convenience.
- I don't see the problem here. For example in
#fertilizer
the type of thefertilizer_type
property resides only inproperties/fertilizer_type/type
. Then depending on the choice of the value of "fertilizer_type", there may be different additional properties. These reside inproperties
in each#fertilizer/oneOf
whereproperties/fertilizer_type/const
is used to choose the right element of theoneOf
. Thefertilizer_type
property has the role of the discriminator object of OpenAPI based on which additional properties are introduced.
Yes, this makes sense. However can we have something to bind the discriminator
to the oneOf
which will let us know if the current element is the discriminator for parent oneOf. Let's discuss this in today's meeting.
- Whenever this is the case, the property key can be used as a fall-back title for a property, and value of the
const
can be used as a fall-back title for the title of a choice. When a title translation is missing, the english title can be used as a fallback. As to your example however, in#fertilizer/fertilizer_applic_method
the title is not missing as it resides in itsallOf[0]
. This is the title for the property, and the tiles in the elements of#/$defs/fertilizer_applic_method/oneOf
are for the choices.
Yes, currently my fallback works in more or less the same way. Also thanks for pointing out that [0]
of allOf
holds the title for the element.
- Right, I have now moved
fertilizer_material
andfertilizer_material_source
intoproperties
.
Thank you!
- Issue - Select multiple options from the select box and render a data table to get inputs.
The
harvest_list
propety of#harvest
is of typearray
and its elements are objects that have properties. The typearray
should be enough to determine that there may be multiple harvested crops. I don't think it is necessary to treat a single harvested crop (an array of length 1) differently than multiple harvested crops (an array of length more than 1). I am not sure what is the best UI approach for adding or removing elements to/from the array, and whether any translated text (maybe to be put to anx-ui
) is needed for these actions.
Yes, this we have to discuss once how are we going to proceed with data of such format.
- Issue - Lack of titles for dropdown choices Elements of "#grazing/properties/grazing_species_age_group/oneOf" are indeed missing titles. See my comment about fallbacks under issue 2. However, I have now added the english titles for convenience.
Thanks! Done.
I have now updated the schema with new x-ui
properties total_of_list
and total_of_property
in each total, for example:
"harvest_yield_harvest_dw_total": {
"title": "yield, total dry weight (kg/ha)",
"title2": "total yield, dry weight (kg/ha)",
"title_fi": "sato, kuivapaino yhteensä (kg/ha)",
"title2_fi": "kokonaissato, kuivapaino (kg/ha)",
"title_sv": "totala skörden, torrvikt (kg/ha)",
"type": "number",
"minimum": 0,
"x-ui": {
"unit": "kg/ha",
"unitless_title": "yield, total dry weight",
"unitless_title2": "total yield, dry weight",
"unitless_title_fi": "sato, kuivapaino yhteensä",
"unitless_title2_fi": "kokonaissato, kuivapaino",
"unitless_title_sv": "totala skörden, torrvikt",
"total_of_list": "harvest_list",
"total_of_property": "harvest_yield_harvest_dw"
}
},
I have found the following inconsistensies in the JSON schema which throws errors while parsing it. I have conditional renders and fallbacks for now, but we need to fix them before moving forward -
Issue - Choosing a subfield
oneOf
select box is rendered seperately but atype
element is also present in the properties. We need to link thistype
element with theoneOf
field in the schema somehow. so that we can prevent multiple renders. Where it is - eg.#fertilizer
,fertilizer_type
property and externaloneOf
field . It is possible that this occurs at other places Possible solution - Remove this externaloneOf
and replace it withfertilizer_type
Issue - Some titles are missing to elements Where it is - At
fertilizer_applic_method
and many moreIssue - The elements are not inside the
properties
field Where it is -soil amendment
in#fertilizer>oneOf
Issue - Select multiple options from the select box and render a data table to get inputs. Where is is expected -
harvested items
in#harvest>properties
if multiple crops are selected, then display a data table to get inputs for all the crops Solution - Add one more field which will tell where a selec box is to be chosen multiple and the data input also must be referenced to this field of harvest items so that it will be generated for multiple elementsIssue - Lack of titles for dropdown choices Where it is -
#grazing