public RepoSchema parseProtoFile()

in src/main/java/com/amazonaws/schemamanager/utils/ProtobufParser.java [43:86]


	public RepoSchema parseProtoFile(String path, String schemaStr, RepoSchema repoSchema) throws Exception{
		if (path == null || path.isEmpty()) {
			throw new IllegalArgumentException("Location cannot be empty: " + path);
		}
		
		if (repoSchema == null) {
			repoSchema = new RepoSchema();
			repoSchema.setPath(path);
		}
		
		ProtoFileElement pfe = ProtoParser.Companion.parse(Location.get(path), schemaStr);
		
		List<SchemaReference> refs = new LinkedList<>();
//		Map<String, ProtoFileElement> localDependencies = new LinkedHashMap<>();
		for (String imprt : pfe.getImports()) {
			ProtoFileElement dependency = dependencies.get(imprt);
			if (dependency == null) {
				throw new Exception("Reference is not resolved yet " + imprt);
			}
//			localDependencies.put(imprt, dependency);
			refs.add(new SchemaReference(imprt, imprt, -1));
		}
		
		ProtobufSchema parsedSchema = new ProtobufSchema(pfe, new LinkedList<>(refs), new LinkedHashMap<>(dependencies));
		parsedSchema.validate();
		repoSchema.setSchema(parsedSchema);
		
		RepoSchemaMetadata repoSchemaMetadata = new RepoSchemaMetadata();
		repoSchema.setMetadata(repoSchemaMetadata);
		
		
//		if(repoSchemaMetadata.getSchemaName() == null){
//			repoSchemaMetadata.setSchemaName(RepoUtils.getFullName(parsedSchema));
//		}
//		
		String pkgName = pfe.getPackageName();
		String refName = pkgName.replaceAll("\\.", "/") + "/" + Paths.get(path).getFileName();
		
		dependencies.put(refName, pfe);
		
		repoSchemaMetadata.setSchemaName(refName);

		return repoSchema;
	}