-
There should be no need for customizations. A "raw" service specification should be enough to generate a client library.
-
The cost of customizations should be proportional to the amount of customizations we are making. It must not have a steep cost cliff when we want to customize a small aspect of the generated code (a.k.a. "the cost of the first customization should be low").
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```plantuml | |
@startuml | |
abstract Model | |
abstract StructuredInformation | |
abstract Entity | |
abstract Operation | |
Operation : Id | |
Operation : status | |
abstract Job | |
abstract Batch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import typing | |
import purl | |
HeadersType = typing.Union[typing.Sequence[typing.Tuple[str, typing.Any]], typing.Mapping[str, typing.Any], None] | |
JsonBodyType = typing.Union[typing.Mapping[str, "JsonBodyType"], str, int, float, bool, None] | |
ParamType2 = typing.Union[typing.Sequence[typing.Tuple[str, typing.Any]], typing.Mapping[str, typing.Any]] | |
ParamType = typing.Union[typing.Sequence[typing.Tuple[str, typing.Any]], typing.Mapping[str, typing.Any]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "Examples of scenarios - #1, more constrained children", | |
"version": "1.0" | |
}, | |
"paths": [], | |
"definitions": { | |
"GenericResource": { | |
"type": "object", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "Show x-ms-paths", | |
"version": "1.0" | |
}, | |
"x-ms-paths": { | |
/* Note - fake query parameter to make the path unique. Not actually used in the API. | |
You can also differentiate using a different path parameter name if the path is parameterized | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typing | |
class InfoFragment(typing.TypedDict): | |
title: str | |
version: str | |
OptionalInAttribute = typing.TypedDict( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "Example of polymorphic models, hypothetical document recognition style", | |
"version": "1.0" | |
}, | |
"consumes": ["application/json"], | |
"produces": ["application/json"], | |
"paths": { | |
"/analyze": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "Example service", | |
"version": "1.1" | |
}, | |
"paths": { | |
"/ComputeNodes": { | |
"parameters": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AiEventMeta(type): | |
def __init__(cls, name, bases, nmspc): | |
super().__init__(name, bases, nmspc) | |
if not hasattr(cls, 'event_type_registry'): | |
setattr(cls, 'event_type_registry', {}) | |
if hasattr(cls, 'EVENT_TYPE_NAME'): | |
cls.event_type_registry[cls.EVENT_TYPE_NAME] = cls | |
class AiEvent(metaclass=AiEventMeta): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import carbon | |
video_stream = ... | |
# Module level function lets you pick a stream, "features" and go | |
# (this assumes there is a default configuration for each feature/category/model) | |
for event in carbon.recognize(video_stream, features=['faceDetection', 'vehicleDetection']): | |
print(event) | |
# Slightly more involved scenario with custom configurations and a dedicated session... |
NewerOlder