Closed as not planned
Description
Summary
The implementation of the Operation constructors uses some magic numbers when parsing the operation ID.
Operations to address
-
CopyModelOperation
-
RecognizeContentOperation
-
RecognizeCustomFormsOperation
-
RecognizeReceiptsOperation
-
RecognizeIdDocumentsOperation
-
TrainingOperation
-
AnalyzeDocumentOperation
-
ClassifyDocumentOperation
Internal constructor
The internal
constructor takes a parameter called operationLocation
, which is returned from the service and is expected to look like:
{endpoint}/formrecognizer/{version}/custom/models/{modelId}/analyzeresults/{resultId}
Public constructor
The public
constructor, on the other hand, takes a parameter called operationId
, which is given by the developer and is expected to be a substring of the aforementioned operationLocation
:
{modelId}/analyzeresults/{resultId}
Goals
- Stop using magic numbers and correctly parse the arguments using regex, handling format errors.
- Make sure we support parsing model IDs with characters
_
,~
, and.
. These characters are allowed when naming a custom model. - Include new tests to verify proper behavior.
- Make sure existing tests still pass reliably.
The following file can be used as a reference:
Related: #10385