Coverage for src/backend/InvenTree/InvenTree/setting/spectacular.py: 100%

3 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 17:47 +0000

1"""Configuration options for drf-spectacular.""" 

2 

3from InvenTree.version import inventreeApiVersion 

4 

5 

6def get_spectacular_settings(): 

7 """Return configuration dictionary for drf-spectacular.""" 

8 return { 

9 'TITLE': 'InvenTree API', 

10 'DESCRIPTION': 'API for InvenTree - the intuitive open source inventory management system', 

11 'LICENSE': { 

12 'name': 'MIT', 

13 'url': 'https://github.com/inventree/InvenTree/blob/master/LICENSE', 

14 }, 

15 'EXTERNAL_DOCS': { 

16 'description': 'More information about InvenTree in the official docs', 

17 'url': 'https://docs.inventree.org', 

18 }, 

19 'VERSION': str(inventreeApiVersion()), 

20 'SERVE_INCLUDE_SCHEMA': False, 

21 'SCHEMA_PATH_PREFIX': '/api/', 

22 'POSTPROCESSING_HOOKS': [ 

23 'InvenTree.schema.postprocess_schema_enums', 

24 'InvenTree.schema.postprocess_required_nullable', 

25 'InvenTree.schema.postprocess_print_stats', 

26 ], 

27 'ENUM_NAME_OVERRIDES': { 

28 'UserTypeEnum': 'users.models.UserProfile.UserType', 

29 'TemplateModelTypeEnum': 'report.models.ReportTemplateBase.ModelChoices', 

30 'AttachmentModelTypeEnum': 'common.models.Attachment.ModelChoices', 

31 'ParameterModelTypeEnum': 'common.models.Parameter.ModelChoices', 

32 'DataImportSessionModelTypeEnum': 'importer.models.DataImportSession.ModelChoices', 

33 # Allauth 

34 'UnauthorizedStatus': [[401, 401]], 

35 'IsTrueEnum': [[True, True]], 

36 }, 

37 # oAuth2 

38 'OAUTH2_FLOWS': ['authorizationCode', 'clientCredentials'], 

39 'OAUTH2_AUTHORIZATION_URL': '/o/authorize/', 

40 'OAUTH2_TOKEN_URL': '/o/token/', 

41 'OAUTH2_REFRESH_URL': '/o/revoke_token/', 

42 }