better fake filename for http/tcp defs, follow openapi doc for global.types

This commit is contained in:
John
2021-11-05 15:46:52 +01:00
parent 395697e2b7
commit b36e610691
+3 -3
View File
@@ -1675,7 +1675,7 @@ result_t MainLoop::executeDefine(const vector<string>& args, ostringstream* ostr
time(&now); time(&now);
string errorDescription; string errorDescription;
istringstream defstr("#\n" + args[argPos]); // ensure first line is not used for determining col names istringstream defstr("#\n" + args[argPos]); // ensure first line is not used for determining col names
return m_messages->readFromStream(&defstr, "temporary", now, true, nullptr, &errorDescription, replace); return m_messages->readFromStream(&defstr, "tcp", now, true, nullptr, &errorDescription, replace);
} }
@@ -2105,7 +2105,7 @@ result_t MainLoop::executeGet(const vector<string>& args, bool* connected, ostri
if (ret == RESULT_OK && !newDefinition.empty()) { if (ret == RESULT_OK && !newDefinition.empty()) {
string errorDescription; string errorDescription;
istringstream defstr("#\n" + newDefinition); // ensure first line is not used for determining col names istringstream defstr("#\n" + newDefinition); // ensure first line is not used for determining col names
ret = m_messages->readFromStream(&defstr, "temporary", now, true, nullptr, &errorDescription, true); ret = m_messages->readFromStream(&defstr, "http", now, true, nullptr, &errorDescription, true);
} }
if (ret == RESULT_OK) { if (ret == RESULT_OK) {
bool first = true; bool first = true;
@@ -2200,7 +2200,7 @@ result_t MainLoop::executeGet(const vector<string>& args, bool* connected, ostri
<< ",\n \"masters\": " << m_busHandler->getMasterCount() << ",\n \"masters\": " << m_busHandler->getMasterCount()
<< ",\n \"messages\": " << m_messages->size() << ",\n \"messages\": " << m_messages->size()
<< ",\n \"lastup\": " << static_cast<unsigned>(maxLastUp); << ",\n \"lastup\": " << static_cast<unsigned>(maxLastUp);
if (withDefinition) { if (withDefinition && since <= 0) {
*ostream << ",\n \"types\": ["; *ostream << ",\n \"types\": [";
DataTypeList::getInstance()->dump(verbosity, true, ostream); DataTypeList::getInstance()->dump(verbosity, true, ostream);
*ostream << "\n ]"; *ostream << "\n ]";