esi / esi-issues

Issue tracking and feature requests for ESI
https://esi.evetech.net/
209 stars 23 forks source link

Bad data while retrieving Plagioclose (TypeId 18) #1096

Closed seraphx2 closed 5 years ago

seraphx2 commented 5 years ago

Bug

The key part here is that when requesting TypeId 18 (Plagioclase) from Universe, Attribute 4 returns 1e35.

{
    "attribute_id": 4,
    "value": 1e35
}

Typically, I have been translating the number type in the swagger definition as decimal in .NET and that has been working fine. However, 1e35 is outside the bounds of decimal, and the fact the API is returning that value and not an actual number, must also mean the number is too large for your own structures.

Request

GET /v3/universe/types/{type_id}/ type_id:18

Response

Status Code

200

Headers

{  
   "requestId": "32326404-ce74-4e6f-a806-0e08c0617ea2",
   "statusCode": 200,
   "endpoint": "/universe/types/{type_id}/",
   "version": "v3",
   "expires": "2019-02-28T06:05:00-05:00",
   "lastModified": "2019-02-26T06:05:48-05:00",
   "eTag": "W/9d62c98645ede8f314a67cdc7f5c52132f52e339ff36ba2e7d0eb61b",
   "errorLimitRemain": 100,
   "errorLimitReset": 33,
   "pages": null
}

Body

{
    "capacity": 0.0,
    "description": "Plagioclase is not amongst the most valuable ore types around, but it contains a large amount of pyerite and is thus always in constant demand. It also yields some tritanium and mexallon.\\r\\n\\r\\nAvailable in <color='0xFF4DFFCC'>0.9<\\/color> security status solar systems or lower.",
    "dogma_attributes": [{
        "attribute_id": 161,
        "value": 0.35
    }, {
        "attribute_id": 162,
        "value": 0.0
    }, {
        "attribute_id": 2115,
        "value": 0.0
    }, {
        "attribute_id": 4,
        "value": 1e35
    }, {
        "attribute_id": 182,
        "value": 3386.0
    }, {
        "attribute_id": 38,
        "value": 0.0
    }, {
        "attribute_id": 2699,
        "value": 1.0
    }, {
        "attribute_id": 1940,
        "value": 28422.0
    }, {
        "attribute_id": 1941,
        "value": 100.0
    }, {
        "attribute_id": 790,
        "value": 12191.0
    }, {
        "attribute_id": 2711,
        "value": 18.0
    }],
    "group_id": 458,
    "icon_id": 230,
    "market_group_id": 516,
    "mass": 1e35,
    "name": "Plagioclase",
    "packaged_volume": 0.35,
    "portion_size": 100,
    "published": true,
    "radius": 1.0,
    "type_id": 18,
    "volume": 0.35
}

Expected

Checklist

Check all boxes that apply to this issue:

snitchashor commented 5 years ago

I just checked the SDE, the mass of all ores is 1e35 there as well.

CarbonAlabel commented 5 years ago

The e notation you refer to as "not an actual number" is a valid way of encoding a number in JSON, and the value attribute is defined in the spec as a single-precision float, with the returned value well within the bounds of the type.

If the type you're using in your code isn't capable of accomodating the value, you'll just have to use another one that is.

Blacksmoke16 commented 5 years ago

@seraphx2 It does.

The swagger.json states that the value property is a float while the attribute_id is int32

{
  "properties": {
    "attribute_id": {
      "description": "attribute_id integer",
      "format": "int32",
      "title": "get_universe_types_type_id_attribute_id",
      "type": "integer"
    },
    "value": {
      "description": "value number",
      "format": "float",
      "title": "get_universe_types_type_id_value",
      "type": "number"
    }
  }
}

The Swagger UI also defines them in the same way.

screen shot 2019-02-27 at 3 27 03 pm

seraphx2 commented 5 years ago

Would be interested to know where you're looking to see what that image shows. Because this image here is the only thing I see that models a response. image

Blacksmoke16 commented 5 years ago

https://esi.evetech.net/ui/#/Universe/get_universe_types_type_id

Under the Responses 200 section => get_universe_types_type_id_dogma_attribute

seraphx2 commented 5 years ago

ok. So why are there different ways to view this? I am coming at it through this URL: https://esi.evetech.net/latest/#/

Blacksmoke16 commented 5 years ago

Notice the /ui/ part in the URL. Pretty sure you're using the legacy swagger UI view.

EDIT: https://developers.eveonline.com/blog/article/esi-open-sourced-front-end

esi-swagger-ui is a fork of the official swagger-ui project and is built on version 3 of that project. 
At the time of this writing, the default view for ESI is still using swagger-ui version 2 at https://esi.tech.ccp.is, but you can see a live running instance of the ESI documentation using swagger-ui version 3 at https://esi.tech.ccp.is/ui/. 
This will be the case until version 3 has a few bugs worked out.

Going to https://esi.evetech.net forwards you to the /ui/ view, but navigating there directly does not.