| 305 | } |
| 306 | |
| 307 | std::string getFieldName(const bool is_array, const IddObject& iddObject, const Json::Value& schema, const std::string& type_description, |
| 308 | const std::size_t group_number, const std::size_t field_number, std::string_view field_name) { |
| 309 | if (is_array) { |
| 310 | return std::string{field_name}; |
| 311 | } |
| 312 | |
| 313 | // Legacy IDD field names |
| 314 | const auto& fieldNames = getSchemaFieldNames(schema, type_description); |
| 315 | |
| 316 | // use the index of the field inside of the IddObject to look up what its name should be |
| 317 | // inside of the epJSON schema |
| 318 | // |
| 319 | // This is (partially) necessary because OpenStudio treats all groups as extensible. |
| 320 | const auto& lookedUpFieldName = |
| 321 | fieldNames[static_cast<int>((group_number - 1) * iddObject.extensibleGroup().size() + field_number + iddObject.nonextensibleFields().size())]; |
| 322 | |
| 323 | LOG_FREE(LogLevel::Error, "epJSONTranslator", "Unable to look up field name for input field" << field_name) |
| 324 | OS_ASSERT(lookedUpFieldName.isString()); |
| 325 | return lookedUpFieldName.asString(); |
| 326 | } |
| 327 | |
| 328 | Json::Value toJSON(const openstudio::IdfFile& idf, const openstudio::path& schemaPath) { |
| 329 | |