kevbite / CompaniesHouse.NET

A simple .NET client wrapper for CompaniesHouse API
MIT License
37 stars 44 forks source link

FillingSubcategory mapping issue #66

Closed poweriton closed 6 years ago

poweriton commented 6 years ago

There is a a problem when your mapping a filling item containing a subcategory. I noticed this on insolvency records. As i dont need it the answer was to comment out


        //[JsonProperty(PropertyName = "subcategory")]
        //[JsonConverter(typeof(StringEnumConverter))]
        //public FilingSubcategory Subcategory { get; set; }

within the filling item. However looking at it im not sure if its because the return contained two subcategory items and the property isnt an array

kevbite commented 6 years ago

Do you have an example of the request you are trying that is failing?

poweriton commented 6 years ago

{"items_per_page":25,"total_count":11,"filing_history_status":"filing-history-available","start_index":0,"items":[{"description":"liquidation-compulsory-winding-up-order","date":"2010-12-01","category":"insolvency","type":"COCOMP","subcategory":["compulsory","court-order"],"links":{"document_metadata":"https://document-api.companieshouse.gov.uk/document/-prSRnOjeQkfdZ7e6aF5F2Co7DB7T0o7hGiXXbfs-RQ","self":"/company/06768813/filing-history/MzAyODAwMjY5OWFkaXF6a2N4"},"pages":2,"paper_filed":true,"barcode":"A9R1KPFZ","transaction_id":"MzAyODAwMjY5OWFkaXF6a2N4"},{"associated_filings":[{"data":{},"description_values":{"date":"2010-02-18","capital":[{"figure":"1","currency":"GBP"}]},"date":"2010-02-18","original_description":"18/02/10 Statement of Capital;GBP 1","category":"capital","description":"statement-of-capital","action_date":1266451200000,"type":"SH01"}],"action_date":"2009-12-09","description_values":{"made_up_date":"2009-12-09"},"description":"annual-return-company-with-made-up-date-full-list-shareholders","date":"2010-02-18","category":"annual-return","type":"AR01","links":{"document_metadata":"https://document-api.companieshouse.gov.uk/document/T6_ZIxFkFQjoDp9FbUO5lS6X8TTx0WJY0roFuXfrcpQ","self":"/company/06768813/filing-history/MzAwOTcwNTczMGFkaXF6a2N4"},"pages":4,"barcode":"XO2UTHMD","transaction_id":"MzAwOTcwNTczMGFkaXF6a2N4"},{"type":"CH01","category":"officers","date":"2010-02-18","description":"change-person-director-company-with-change-date","description_values":{"change_date":"2009-12-05","officer_name":"Ms Ann Marie Coughlan"},"action_date":"2009-12-05","subcategory":"change","links":{"document_metadata":"https://document-api.companieshouse.gov.uk/document/P_58ohtBoaz_jzNL6N4bT7BLhmoJ1BMRhLXxotzAZWc","self":"/company/06768813/filing-history/MzAwOTcwNDgxN2FkaXF6a2N4"},"pages":2,"barcode":"XO2USHMC","transaction_id":"MzAwOTcwNDgxN2FkaXF6a2N4"},{"description":"change-person-secretary-company-with-change-date","date":"2010-02-18","category":"officers","type":"CH03","subcategory":"change","action_date":"2009-12-05","description_values":{"officer_name":"Ms Ann Marie Coughlan","change_date":"2009-12-05"},"links":{"document_metadata":"https://document-api.companieshouse.gov.uk/document/FjAi5ftyYL-0Ud7j-YIyTEN0xqq4CDHfjmiDge95aN0","self":"/company/06768813/filing-history/MzAwOTcwNDgxNmFkaXF6a2N4"},"pages":1,"barcode":"XO2URHMB","transaction_id":"MzAwOTcwNDgxNmFkaXF6a2N4"},{"description_values":{"description":"Secretary appointed ms ann marie coughlan"},"date":"2009-03-25","description":"legacy","type":"288a","category":"officers","links":{"document_metadata":"https://document-api.companieshouse.gov.uk/document/rVh7aViBg8hNZRM-d5KplewhJlkCZRoTT21xIPwT05o","self":"/company/06768813/filing-history/MjAyOTAzOTU1MGFkaXF6a2N4"},"pages":1,"barcode":"X15I98GI","transaction_id":"MjAyOTAzOTU1MGFkaXF6a2N4"},{"description_values":{"description":"Director appointed ms ann marie coughlan"},"type":"288a","category":"officers","date":"2009-03-25","description":"legacy","links":{"document_metadata":"https://document-api.companieshouse.gov.uk/document/8Yf3cHN_FN-cd4CWYmfeav_QXSSlZLuFVkaDMgEQnyk","self":"/company/06768813/filing-history/MjAyOTAzOTU0OWFkaXF6a2N4"},"pages":1,"barcode":"X15I88GH","transaction_id":"MjAyOTAzOTU0OWFkaXF6a2N4"},{"category":"officers","type":"288b","description":"legacy","date":"2009-03-25","description_values":{"description":"Appointment terminated director lucy davies"},"links":{"self":"/company/06768813/filing-history/MjAyOTAzOTQ4NWFkaXF6a2N4","document_metadata":"https://document-api.companieshouse.gov.uk/document/Rb8aQCuayEOmyRvzfvvW5wfQTPNRSJG2nYkgbX-rp3U"},"pages":1,"barcode":"X15G28G9","transaction_id":"MjAyOTAzOTQ4NWFkaXF6a2N4"},{"date":"2009-02-27","description":"legacy","type":"287","category":"address","description_values":{"description":"Registered office changed on 27/02/2009 from 10 avonlea gardens rugeley WS15 2SY uk"},"links":{"document_metadata":"https://document-api.companieshouse.gov.uk/document/0PBz1GZJkpCoEw54ehO5zMXFgxXPDrXBqVStvGzeSm8","self":"/company/06768813/filing-history/MjAyNjkyOTc0MmFkaXF6a2N4"},"pages":1,"paper_filed":true,"barcode":"ATUIJ7OT","transaction_id":"MjAyNjkyOTc0MmFkaXF6a2N4"},{"type":"288a","category":"officers","date":"2009-01-15","description":"legacy","description_values":{"description":"Director appointed lucy davies"},"links":{"document_metadata":"https://document-api.companieshouse.gov.uk/document/Y2cV4URYXt2xUQJcnzSUcB7gNV-FvzfiyAgAeKtnsVQ","self":"/company/06768813/filing-history/MjAyMzM3NjYxNWFkaXF6a2N4"},"pages":1,"paper_filed":true,"barcode":"AL7696I5","transaction_id":"MjAyMzM3NjYxNWFkaXF6a2N4"},{"type":"288b","category":"officers","date":"2008-12-09","description":"legacy","description_values":{"description":"Appointment terminated director peter valaitis"},"links":{"document_metadata":"https://document-api.companieshouse.gov.uk/document/5_whwSX14osp9raMHSsS-ev38d-wqFXtJEB-gISn2-g","self":"/company/06768813/filing-history/MjAxOTY2MzA2NmFkaXF6a2N4"},"pages":1,"barcode":"XAXTO5I8","transaction_id":"MjAxOTY2MzA2NmFkaXF6a2N4"},{"description":"incorporation-company","date":"2008-12-09","category":"incorporation","type":"NEWINC","links":{"document_metadata":"https://document-api.companieshouse.gov.uk/document/DPmOmUtAjdpWrbFuml3hzS1OP8g2lfjo0P6VOplAz38","self":"/company/06768813/filing-history/MjAxOTYxNzM5MmFkaXF6a2N4"},"pages":13,"paper_filed":true,"barcode":"XARHZ5H0","transaction_id":"MjAxOTYxNzM5MmFkaXF6a2N4"}]}

kevbite commented 6 years ago

Looks like they've changed the API so that subcategory can be an array or a string.

"subcategory":"change"
"subcategory":["compulsory","court-order"]
poweriton commented 6 years ago

thought as much, the descriptions for the above are also missing from the subcategory enums.

kevbite commented 6 years ago

Shouldn't take too long to fix up 👍

poweriton commented 6 years ago

good work. I hate filling issues as it implies a complaint. Id be lost without this library so thanks a bunch and keep up the good work

kevbite commented 6 years ago

No worries, I'd rather people raise issues so we can get them ironed out, and it looks like they've just extended the API so better for us to support it.

Pretty much nearly there, just some of the tests are failing because they're expecting some old values. I'll, however, sort them in the morning.

kevbite commented 6 years ago

This is all fixed in version 4.0.0.

kevbite commented 6 years ago

I'm closing this issue but if you have any more problems don't hesitate to open another issue. 👍