h21lab / 5gc_build Goto Github PK
View Code? Open in Web Editor NEWProject to use OpenAPI generators to build code from 5GC_API
License: Apache License 2.0
Project to use OpenAPI generators to build code from 5GC_API
License: Apache License 2.0
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] {}/5GC_build/5GC_code_generator/target/generated-sources/src/main/java/com/h21lab/TS29510_Nnrf_NFDiscovery/handler/NFStatus.java:[52,31] cannot access com.h21lab.TS29510_Nnrf_NFDiscovery.handler.AbstractOpenApiSchema
bad source file: {}/5GC_build/5GC_code_generator/target/generated-sources/src/main/java/com/h21lab/TS29510_Nnrf_NFDiscovery/handler/AbstractOpenApiSchema.java
file does not contain class com.h21lab.TS29510_Nnrf_NFDiscovery.handler.AbstractOpenApiSchema
Please remove or make sure it appears in the correct subdirectory of the sourcepath.
Really appreciate taking time to create this repo, I have problem in generating stub for NRF, I just edited the pom.xml file to have only NRF but getting the following error, any help from you will be really appreciated
pom.xml file
python-flask ${project.build.directory}/generated-sources <executions>
<execution>
<id>1</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/5GC_APIs/TS29510_Nnrf_NFDiscovery.yaml</inputSpec>
<modelPackage>com.h21lab.TS29510_Nnrf_NFDiscovery.handler</modelPackage>
<apiPackage>com.h21lab.TS29510_Nnrf_NFDiscovery.model</apiPackage>
<invokerPackage>com.h21lab.TS29510_Nnrf_NFDiscovery.handler</invokerPackage>
</configuration>
</execution>
</executions>
when I run the server stub, getting the below error
root@Focal:/home/generator/5GC_build/5GC_code_generator/target/generated-sources# python3 -m openapi_server
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/generator/5GC_build/5GC_code_generator/target/generated-sources/openapi_server/main.py", line 19, in
main()
File "/home/generator/5GC_build/5GC_code_generator/target/generated-sources/openapi_server/main.py", line 11, in main
app.add_api('openapi.yaml',
File "/usr/local/lib/python3.8/dist-packages/connexion/apps/flask_app.py", line 72, in add_api
api = super().add_api(specification, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/connexion/apps/abstract.py", line 149, in add_api
api = self.api_cls(specification,
File "/usr/local/lib/python3.8/dist-packages/connexion/apis/abstract.py", line 81, in init
self.specification = Specification.load(specification, arguments=arguments)
File "/usr/local/lib/python3.8/dist-packages/connexion/spec.py", line 194, in load
return cls.from_file(spec, arguments=arguments)
File "/usr/local/lib/python3.8/dist-packages/connexion/spec.py", line 148, in from_file
return cls.from_dict(spec)
File "/usr/local/lib/python3.8/dist-packages/connexion/spec.py", line 186, in from_dict
return OpenAPISpecification(spec)
File "/usr/local/lib/python3.8/dist-packages/connexion/spec.py", line 74, in init
self._validate_spec(raw_spec)
File "/usr/local/lib/python3.8/dist-packages/connexion/spec.py", line 92, in _validate_spec
raise InvalidSpecification.create_from(e)
connexion.exceptions.InvalidSpecification: {'content': {'application/json': {'schema': {'items': {'$ref': '#/components/schemas/PlmnId'}, 'minItems': 1, 'type': 'array'}}}, 'description': 'Id of the PLMN of the target NF', 'explode': True, 'in': 'query', 'name': 'target-plmn-list', 'required': False, 'style': 'form'} is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^\/']['patternProperties']['^(get|put|post|delete|options|head|patch|trace)$']['properties']['parameters']['items']:
{'oneOf': [{'$ref': '#/definitions/Parameter'},
{'$ref': '#/definitions/Reference'}]}
On instance['paths']['/nf-instances']['get']['parameters'][6]:
{'content': {'application/json': {'schema': {'items': {'$ref': '#/components/schemas/PlmnId'},
'minItems': 1,
'type': 'array'}}},
'description': 'Id of the PLMN of the target NF',
'explode': True,
'in': 'query',
'name': 'target-plmn-list',
'required': False,
'style': 'form'}
The same works for the N32 handshake that is present in your default pom without any changes but anything other than that is failing
While parsing the code in we encountered an error where target_nf_type is showing error
Exactly what should be set/define in the target_nf_target and requester_nf_type before calling
While going through the documentation it was found that string type should be used but while using it error was encountered.
Below is the code for reference
Python version - 3.8.10
Code -
import openapi_client
from com.h21lab.TS29510_Nnrf_NFDiscovery.model import nf_instances__store_api
from openapi_client.model.nf_type import NFType
from pprint import pprint
configuration = openapi_client.Configuration(
host = "http://localhost/nnrf-disc/v1"
)
with openapi_client.ApiClient(configuration) as api_client:
api_instance = nf_instances__store_api.NFInstancesStoreApi(api_client)
target_nf_type = NFType
requester_nf_type = NFType
try:
api_response = api_instance.search_nf_instances(target_nf_type, requester_nf_type)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling NFInstancesStoreApi->search_nf_instances: %s\n" % e)
Output-
Traceback (most recent call last):
File "/home/developer/python/abc.py", line 16, in
api_response = api_instance.search_nf_instances(target_nf_type, requester_nf_type)
File "/usr/local/lib/python3.8/dist-packages/openapi_client/api_client.py", line 771, in call
return self.callable(self, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/com/h21lab/TS29510_Nnrf_NFDiscovery/model/nf_instances__store_api.py", line 209, in __search_nf_instances
return self.call_with_http_info(**kwargs)
File "/usr/local/lib/python3.8/dist-packages/openapi_client/api_client.py", line 833, in call_with_http_info
return self.api_client.call_api(
File "/usr/local/lib/python3.8/dist-packages/openapi_client/api_client.py", line 408, in call_api
return self.__call_api(resource_path, method,
File "/usr/local/lib/python3.8/dist-packages/openapi_client/api_client.py", line 163, in __call_api
query_params = self.sanitize_for_serialization(query_params)
File "/usr/local/lib/python3.8/dist-packages/openapi_client/api_client.py", line 284, in sanitize_for_serialization
return [cls.sanitize_for_serialization(item) for item in obj]
File "/usr/local/lib/python3.8/dist-packages/openapi_client/api_client.py", line 284, in
return [cls.sanitize_for_serialization(item) for item in obj]
File "/usr/local/lib/python3.8/dist-packages/openapi_client/api_client.py", line 284, in sanitize_for_serialization
return [cls.sanitize_for_serialization(item) for item in obj]
File "/usr/local/lib/python3.8/dist-packages/openapi_client/api_client.py", line 284, in
return [cls.sanitize_for_serialization(item) for item in obj]
File "/usr/local/lib/python3.8/dist-packages/openapi_client/api_client.py", line 287, in sanitize_for_serialization
raise ApiValueError('Unable to prepare type {} for serialization'.format(obj.class.name))
openapi_client.exceptions.ApiValueError: Unable to prepare type type for serialization
Any help would be appreciated.
Thanks in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.