constants
#
Important constants for related to codegen
Classes:
Name | Description |
---|---|
CHOAS |
Enum of available |
ExitCode |
Exit codes related to the main function. |
ReFormatFlags |
Flags for formatting. |
URLScheme |
Enum of URL schemes supported by codegen. |
Attributes:
Name | Type | Description |
---|---|---|
COMPANIES_HOUSE_HOST |
developer-specs.company-information.service.gov.uk is the |
|
COMPANIES_HOUSE_PORT |
Port 10000 is used by Companies House for transmitting web data |
|
LOCALHOST_IP |
127.0.0.1 is known as the loopback address or localhost, |
|
LOOPBACK_ADDR |
http://127.0.0.1:10000 is the url (loopback address) used by Companies House |
|
RE_REMOTE_JSON_REF_PATH |
Regex pattern for Remote JSON |
|
RE_URL |
Regex pattern of an http/https/ftp/ftps url. |
|
SELECT_ALL_FORMAT_FLAGS |
Union off all FormatFlags. |
ALLOWED_TYPES
module-attribute
#
The primitive data types allowed in the
Swagger Specification <https://swagger.io/specification/v2/#data-types>
_
COMPANIES_HOUSE_HOST
module-attribute
#
developer-specs.company-information.service.gov.uk is the
host<https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2>
_ name of
companies house Developer's API suite (where Specifactions are hosted)
COMPANIES_HOUSE_PORT
module-attribute
#
Port 10000 is used by Companies House for transmitting web data over the localhost network using the Hypertext Transfer Protocol (HTTP)
LOCALHOST_IP
module-attribute
#
127.0.0.1 is known as the loopback address or localhost, which is used for testing applications on the same device without needing an internet connection. It allows a computer to communicate with itself for various tasks.
LOOPBACK_ADDR
module-attribute
#
LOOPBACK_ADDR = f'http://{LOCALHOST_IP}:{COMPANIES_HOUSE_PORT}'
http://127.0.0.1:10000 is the url (loopback address) used by Companies House for testing API applications on the same device without needing an internet connection. It allows a computer to communicate with itself for various tasks.
RE_REMOTE_JSON_REF_PATH
module-attribute
#
Regex pattern for Remote JSON
RE_SERVER_ADDR
module-attribute
#
RE_SERVER_ADDR = compile('(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\.)+(?:[A-Z]{2,6}\\.?|[A-Z0-9-]{2,}\\.?)|localhost|\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})(?::\\d+)?', IGNORECASE)
Regex pattern for server address
RE_URL
module-attribute
#
RE_URL = compile('^(?:http|ftp)s?://(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\.)+(?:[A-Z]{2,6}\\.?|[A-Z0-9-]{2,}\\.?)|localhost|\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})(?::\\d+)?(?:/?|[/?]\\S+)\\Z', IGNORECASE)
Regex pattern of an http/https/ftp/ftps url.
See Also
https://github.com/django/django/blob/stable/1.4.x/django/core/validators.py#L47
SELECT_ALL_FORMAT_FLAGS
module-attribute
#
SELECT_ALL_FORMAT_FLAGS = TYPE_DATE_TO_STRING | TYPE_ARRAY_ENSURE_ITEMS | PATHS_ENSURE_SNAKECASE | TYPE_LIST_TO_ARRAY | PARAM_TITLE_TO_NAME | PARAM_PARAMTYPE_TO_IN
Union off all FormatFlags.
CHOAS
#
Enum of available Companies House OpenAPI (Swagger 2.0) Specfications.
See Also
Companies House Developer's API suite<https://developer-specs.company-information.service.gov.uk>
_
Attributes:
Name | Type | Description |
---|---|---|
DISCREPANCIES |
For use only by Obliged Entities to report PSC Discrepancies |
|
DOCUMENT_API |
API suite providing company filing history document metadata and downloads. |
|
IDENTITY_SERVICE |
Companies House identity and authentication service. |
|
MANIPULATE_COMPANY_DATA |
An API suite that allows clients to manipulate company information, |
|
PUBLIC_DATA_API |
An API suite providing read only access to search and retrieve public company data |
|
SANDBOX_TEST_DATA_GENERATOR_API |
Sandbox API suite to generate test data on demand |
|
STREAMING_API |
A streaming API giving access to real time data changes. |
DISCREPANCIES
class-attribute
instance-attribute
#
DISCREPANCIES = 'https://developer-specs.company-information.service.gov.uk/api.ch.gov.uk-specifications/swagger-2.0/spec/pscDiscrepancies.json'
For use only by Obliged Entities to report PSC Discrepancies
DOCUMENT_API
class-attribute
instance-attribute
#
DOCUMENT_API = 'https://developer-specs.company-information.service.gov.uk/document.api.ch.gov.uk-specifications/swagger-2.0/spec/swagger.json'
API suite providing company filing history document metadata and downloads.
IDENTITY_SERVICE
class-attribute
instance-attribute
#
IDENTITY_SERVICE = 'https://developer-specs.company-information.service.gov.uk/account.ch.gov.uk-specifications/swagger-2.0/identity-public.json'
Companies House identity and authentication service.
MANIPULATE_COMPANY_DATA
class-attribute
instance-attribute
#
MANIPULATE_COMPANY_DATA = 'https://developer-specs.company-information.service.gov.uk/api.ch.gov.uk-specifications/swagger-2.0/spec/filings-public.json'
An API suite that allows clients to manipulate company information, if they have authority to do so.
PUBLIC_DATA_API
class-attribute
instance-attribute
#
PUBLIC_DATA_API = 'https://developer-specs.company-information.service.gov.uk/api.ch.gov.uk-specifications/swagger-2.0/spec/swagger.json'
An API suite providing read only access to search and retrieve public company data
SANDBOX_TEST_DATA_GENERATOR_API
class-attribute
instance-attribute
#
SANDBOX_TEST_DATA_GENERATOR_API = 'https://developer-specs.company-information.service.gov.uk/api.ch.gov.uk-specifications/swagger-2.0/spec/testDataGenerator.json'
Sandbox API suite to generate test data on demand
STREAMING_API
class-attribute
instance-attribute
#
STREAMING_API = 'https://developer-specs.company-information.service.gov.uk/api.ch.gov.uk-specifications/swagger-2.0/spec/streaming.json'
A streaming API giving access to real time data changes.
ExitCode
#
Exit codes related to the main function.
ReFormatFlags
#
Flags for formatting.
See Also
reformat_swagger: Reformats Companies House Swagger 2.0 specifications (in-place) and returns refs defined in the schema.
Attributes:
Name | Type | Description |
---|---|---|
PARAM_PARAMTYPE_TO_IN |
Convert |
|
PARAM_TITLE_TO_NAME |
Convert |
|
PATHS_ENSURE_SNAKECASE |
Ensure that path parameters use snakecase. |
|
TYPE_ARRAY_ENSURE_ITEMS |
Ensure that |
|
TYPE_DATE_TO_STRING |
Convert instances of |
|
TYPE_INFER_BOOLEANS |
Infers if type is a boolean. |
|
TYPE_LIST_TO_ARRAY |
Convert instance of |
PARAM_PARAMTYPE_TO_IN
class-attribute
instance-attribute
#
Convert parameters<paramType>
to parameters<in>
and delete the paramType
key.
PARAM_TITLE_TO_NAME
class-attribute
instance-attribute
#
Convert parameters[_]<title>
to parameters[_]<name>
and delete the title
key.
PATHS_ENSURE_SNAKECASE
class-attribute
instance-attribute
#
Ensure that path parameters use snakecase.
TYPE_ARRAY_ENSURE_ITEMS
class-attribute
instance-attribute
#
Ensure that items
attribute is in array.
TYPE_DATE_TO_STRING
class-attribute
instance-attribute
#
Convert instances of type<date>
to type<string(format="date")>
TYPE_INFER_BOOLEANS
class-attribute
instance-attribute
#
Infers if type is a boolean.
TYPE_LIST_TO_ARRAY
class-attribute
instance-attribute
#
Convert instance of type<list>
to type<array(item='string')>
URLScheme
#
Enum of URL schemes supported by codegen.
Attributes:
Name | Type | Description |
---|---|---|
FTP |
|
|
FTPS |
|
|
HTTP |
|
|
HTTPS |
|
FTP
class-attribute
instance-attribute
#
FTP<https://datatracker.ietf.org/doc/html/rfc114>
_
(File Transfer Protocol) is a standardized way of transfering
files between computers on a network.
TODO: ftp support
FTPS
class-attribute
instance-attribute
#
FTPS<https://en.wikipedia.org/wiki/FTPS>
(File Transfer Protocol (FTP) Secure)
is an extension of FTP
that uses TLS<https://en.wikipedia.org/wiki/Transport_Layer_Security>
(Transport Layer Security) to secure communications
over a computer network, making it safer for transferring sensitive files.
TODO: Implement https://stackoverflow.com/a/73171311
HTTP
class-attribute
instance-attribute
#
HTTP<https://datatracker.ietf.org/doc/html/rfc9110>
(Hypertext Transfer Protocol) is a stateless application protocol
in the Internet protocol suite<https://en.wikipedia.org/wiki/Internet_protocol_suite>
for distributed, collaborative, hypertext information systems.
HTTPS
class-attribute
instance-attribute
#
HTTPS<https://en.wikipedia.org/wiki/HTTPS>
_
(Hypertext Transfer Protocol Secure) is an extension of HTTP
that uses encryption to secure communications over a computer network,
making it safer for transmitting sensitive data.
This ensures protect user privacy and data integrity
during online transactions over the internet.