2016-04-20 5 views
1

wir ein Problem mit attributesFormat=object gefunden, während die Anwendung Tourguide Testen https://github.com/Fiware/tutorials.TourGuide-Appungültiger JSON wenn attributesFormat = Objekt in der Reiseleitung verwendet wird

Wenn wir die folgende Anforderung erfüllen:

curl <cb_host>:<cb_port>/v1/contextEntities/type/Restaurant/id/Elizalde -s -S --header 'Content-Type: application/json' --header 'x-auth-token:<token>' --header 'Fiware-service: tourguide' --header 'Accept: application/json' 

wir bekommen diese gültig JSON:

{ 
    "contextElement" : { 
    "type" : "Restaurant", 
    "isPattern" : "false", 
    "id" : "Elizalde", 
    "attributes" : [ 
     { 
     "name" : "address", 
     "type" : "", 
     "value" : { 
      "type" : "postalAddress", 
      "streetAddress" : "Cuesta de las Cabras Aldapa 2", 
      "addressRegion" : "Araba", 
      "addressLocality" : "Alegría-Dulantzi", 
      "postalCode" : "01240" 
     } 
     }, 
     { 
     "name" : "aggregateRating", 
     "type" : "", 
     "value" : { 
      "reviewCount" : 1, 
      "ratingValue" : 3 
     } 
     }, 
     { 
     "name" : "capacity", 
     "type" : "PropertyValue", 
     "value" : 120, 
     "metadatas" : [ 
      { 
      "name" : "name", 
      "type" : "", 
      "value" : "capacity" 
      } 
     ] 
     }, 
     { 
     "name" : "department", 
     "type" : "", 
     "value" : "Franchise3" 
     }, 
     { 
     "name" : "description", 
     "type" : "", 
     "value" : "Restaurante de estilo sidrería ubicado en Alegria-Dulantzi. Además de su menú del día y carta, también ofrece menú de sidrería. El menú del día cuesta 9 euros. Los fines de semana la especialidad de la casa son las alubias con sacramentos. En lo que a bebidas se refiere, hay una amplia selección además de la sidra. Cabe destacar que se puede hacer txotx. La capacidad del establecimiento es de 50 personas pero la sidrería no dispone de aparcamiento.%5cn%5cnHORARIO: %5cn%5cnLunes a domingo: 9:00-17:00 y 19:00-23:00." 
     }, 
     { 
     "name" : "occupancyLevels", 
     "type" : "PropertyValue", 
     "value" : 0, 
     "metadatas" : [ 
      { 
      "name" : "timestamp", 
      "type" : "", 
      "value" : "" 
      }, 
      { 
      "name" : "name", 
      "type" : "", 
      "value" : "occupancyLevels" 
      } 
     ] 
     }, 
     { 
     "name" : "position", 
     "type" : "coords", 
     "value" : "42.8404625, -2.5123277", 
     "metadatas" : [ 
      { 
      "name" : "location", 
      "type" : "string", 
      "value" : "WGS84" 
      } 
     ] 
     }, 
     { 
     "name" : "priceRange", 
     "type" : "", 
     "value" : 0 
     }, 
     { 
     "name" : "telephone", 
     "type" : "", 
     "value" : "945 400 868" 
     } 
    ] 
    }, 
    "statusCode" : { 
    "code" : "200", 
    "reasonPhrase" : "OK" 
    } 
} 

Aber wenn wir verwenden, um die attributesFormat = Objekt:

curl <cb_host>:<cb_port>/v1/contextEntities/type/Restaurant/id/Elizalde?attributesFormat=object -s -S --header 'Content-Type: application/json' --header 'x-auth-token:<token>' --header 'Fiware-service: tourguide' --header 'Accept: application/json' 

bekommen wir diese ungültige JSON:

{ 
    "contextElement": { 
     "type": "Restaurant", 
     "isPattern": "false", 
     "id": "Elizalde", 
     "attributes": { 
      "address": { 
       "type": "", 
       "value": { 
        "type": "postalAddress", 
        "streetAddress": "Cuesta de las Cabras Aldapa 2", 
        "addressRegion": "Araba", 
        "addressLocality": "Alegría-Dulantzi", 
        "postalCode": "01240" 
       } 
      }, 
      "aggregateRating": { 
       "type": "", 
       "value": { 
        "reviewCount": 1, 
        "ratingValue": 3 
       } 
      }, 
      "capacity": { 
       "type": "PropertyValue", 
       "120", 
       "metadatas": [{ 
        "name": "name", 
        "type": "", 
        "value": "capacity" 
       }] 
      }, 
      "department": { 
       "type": "", 
       "value": "Franchise3" 
      }, 
      "description": { 
       "type": "", 
       "value": "Restaurante de estilo sidrería ubicado en Alegria-Dulantzi. Además de su menú del día y carta, también ofrece menú de sidrería. El menú del día cuesta 9 euros. Los fines de semana la especialidad de la casa son las alubias con sacramentos. En lo que a bebidas se refiere, hay una amplia selección además de la sidra. Cabe destacar que se puede hacer txotx. La capacidad del establecimiento es de 50 personas pero la sidrería no dispone de aparcamiento.%5cn%5cnHORARIO: %5cn%5cnLunes a domingo: 9:00-17:00 y 19:00-23:00." 
      }, 
      "occupancyLevels": { 
       "type": "PropertyValue", 
       "0", 
       "metadatas": [{ 
        "name": "timestamp", 
        "type": "", 
        "value": "" 
       }, { 
        "name": "name", 
        "type": "", 
        "value": "occupancyLevels" 
       }] 
      }, 
      "position": { 
       "type": "coords", 
       "value": "42.8404625, -2.5123277", 
       "metadatas": [{ 
        "name": "location", 
        "type": "string", 
        "value": "WGS84" 
       }] 
      }, 
      "priceRange": { 
       "type": "", 
       "0" 
      }, 
      "telephone": { 
       "type": "", 
       "value": "945 400 868" 
      } 
     } 
    }, 
    "statusCode": { 
     "code": "200", 
     "reasonPhrase": "OK" 
    } 
} 

Schritte zu replizieren:

Informationen über orion Version:

<orion> 
    <version>0.28.0</version> 
    <uptime>0 d, 1 h, 12 m, 25 s</uptime> 
    <git_hash>aaf8020a5de680b6d7e0c00c70cf425bcc4f39c8</git_hash> 
    <compile_time>Mon Mar 21 13:20:37 UTC 2016</compile_time> 
    <compiled_by>root</compiled_by> 
    <compiled_in>838a42ae8431</compiled_in> 
</orion> 
+0

Können Sie Ihren Fragenbeitrag bearbeiten, um die von Ihnen verwendete Orion-Version hinzuzufügen? I.e. 'GET/version' auf der Orion API. Vielen Dank! – fgalan

Antwort

1

Dies ist aufgrund eines Fehlers mit attributeFormat=object Rendering in Orion 0.28.0. Der Bug wird für Orion 1.1.0 behoben, der bis Ende April 2016 veröffentlicht werden soll (es wird gerade in den Entwicklungszweig integriert, dies ist the PR, wenn Sie den Fortschritt überwachen wollen).

+0

Danke, wir werden die PR im Auge behalten. –

+0

Bitte denken Sie daran, die Antwort zu verbessern und zu befolgen (nicht nur, um mein Ego zu füttern;), sondern auch, um anderen Benutzern klar zu machen, dass diese Antwort richtig ist). – fgalan

Verwandte Themen